Skip to content

Commit

Permalink
added tips to README.md
Browse files Browse the repository at this point in the history
Signed-off-by: StoneyDSP <nathanjhood@googlemail.com>
  • Loading branch information
nathanjhood committed Oct 17, 2024
1 parent bf3a648 commit b22ba9e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,12 @@ const button = Button();
// example

const CustomButton = (): HTMLButtonElement => {
class CustomButton extends HTMLButtonElement {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
}
}
customElements.define('custom-button', CustomButton)
customElements.define('custom-button', CustomButtonElement)
return document.createElement<'button'>('button');
};

Expand All @@ -337,13 +337,13 @@ type CustomButtonProps = {
};

const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
class CustomButton extends HTMLButtonElement {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
this.type = props.type;
}
}
customElements.define('custom-button', CustomButton);
customElements.define('custom-button', CustomButtonElement);
return document.createElement<'button'>('button');
};

Expand All @@ -362,14 +362,14 @@ type CustomButtonProps = {
};

const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
class CustomButton extends HTMLButtonElement {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
this.type = props.type;
if (props.children) this.appendChild(props.children);
}
}
customElements.define('custom-button', CustomButton);
customElements.define('custom-button', CustomButtonElement);
return document.createElement<'button'>('button');
};

Expand All @@ -390,15 +390,15 @@ type CustomButtonProps = {
};

const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
class CustomButton extends HTMLButtonElement {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
this.type = props.type;
if (props.children) this.appendChild(props.children);
if (props.className) this.className = props.className;
}
}
customElements.define('custom-button', CustomButton);
customElements.define('custom-button', CustomButtonElement);
return document.createElement<'button'>('button');
};

Expand Down

0 comments on commit b22ba9e

Please sign in to comment.