Skip to content

Commit

Permalink
website: update example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 16, 2022
1 parent 428da4a commit e843a6f
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions demo.html
Expand Up @@ -139,39 +139,6 @@ <h1>Hi there!</h1>
});
\`\`\`
## Properties
Properties can be set directly on the custom element at creation time, or dynamically via JavaScript.
\`\`\`typescript
export type ColorScheme = 'light' | 'dark';
export class DarkMode extends HTMLElement {
mode?: ColorScheme;
/**
* Defaults to not remember the last choice.
* If present remembers the last selected mode (\`dark\` or \`light\`),
* which allows the user to permanently override their usual preferred color scheme.
*/
permanent?: boolean;
/**
* Any string value that represents the label for the "dark" mode.
*/
dark?: string;
/**
* Any string value that represents the label for the "light" mode.
*/
light?: string;
style?: React.CSSProperties;
}
\`\`\`
## Events
- \`colorschemechange\`: Fired when the color scheme gets changed.
- \`permanentcolorscheme\`: Fired when the color scheme should be permanently remembered or not.
## Complete Example
Interacting with the custom element:
\`\`\`js
Expand Down Expand Up @@ -215,6 +182,37 @@ <h1>Hi there!</h1>
});
\`\`\`
## Properties
Properties can be set directly on the custom element at creation time, or dynamically via JavaScript.
\`\`\`typescript
export type ColorScheme = 'light' | 'dark';
export class DarkMode extends HTMLElement {
mode?: ColorScheme;
/**
* Defaults to not remember the last choice.
* If present remembers the last selected mode (\`dark\` or \`light\`),
* which allows the user to permanently override their usual preferred color scheme.
*/
permanent?: boolean;
/**
* Any string value that represents the label for the "dark" mode.
*/
dark?: string;
/**
* Any string value that represents the label for the "light" mode.
*/
light?: string;
style?: React.CSSProperties;
}
\`\`\`
## Events
- \`colorschemechange\`: Fired when the color scheme gets changed.
- \`permanentcolorscheme\`: Fired when the color scheme should be permanently remembered or not.
## Alternatives
- [dark-mode-toggle](https://github.com/GoogleChromeLabs/dark-mode-toggle) <img align="bottom" height="13" src="https://img.shields.io/github/stars/GoogleChromeLabs/dark-mode-toggle.svg?label=" /> A custom element that allows you to easily put a Dark Mode 馃寬 toggle or switch on your site
Expand Down

0 comments on commit e843a6f

Please sign in to comment.