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 2dd74f8 commit b515383
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 @@ -313,14 +313,14 @@ const button = Button();
```ts
// example

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

// CustomButtom
Expand All @@ -336,15 +336,15 @@ type CustomButtonProps = {
type: 'submit' | 'reset' | 'button';
};

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

const customButton = CustomButton({ type: 'submit' });
Expand All @@ -361,7 +361,7 @@ type CustomButtonProps = {
children?: Node;
};

const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
const CustomButton = (props: CustomButtonProps) => {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
Expand All @@ -370,7 +370,7 @@ const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
}
}
customElements.define('custom-button', CustomButtonElement);
return document.createElement<'button'>('button');
return document.createElement('custom-button') as CustomButtonElement;
};

const customButtonA = CustomButton({ type: 'submit' });
Expand All @@ -389,7 +389,7 @@ type CustomButtonProps = {
className?: string;
};

const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
const CustomButton = (props: CustomButtonProps) => {
class CustomButtonElement extends HTMLButtonElement {
constructor() {
super();
Expand All @@ -399,7 +399,7 @@ const CustomButton = (props: CustomButtonProps): HTMLButtonElement => {
}
}
customElements.define('custom-button', CustomButtonElement);
return document.createElement<'button'>('button');
return document.createElement('custom-button') as CustomButtonElement;
};

const tailwindButton = CustomButton({
Expand Down

0 comments on commit b515383

Please sign in to comment.