feat(ui): add light theme toggle
This commit is contained in:
parent
bbc81cea0d
commit
cdb269e505
17 changed files with 415 additions and 24 deletions
|
|
@ -14,12 +14,40 @@ if (typeof window !== "undefined") {
|
|||
}
|
||||
|
||||
const preview: Preview = {
|
||||
decorators: [
|
||||
(Story, context) => {
|
||||
const theme = context.globals.theme === "light" ? "light" : "dark";
|
||||
|
||||
if (typeof document !== "undefined") {
|
||||
document.documentElement.setAttribute("data-ui-theme", theme);
|
||||
}
|
||||
|
||||
return Story();
|
||||
},
|
||||
],
|
||||
globalTypes: {
|
||||
theme: {
|
||||
description: "Dashboard component theme",
|
||||
defaultValue: "dark",
|
||||
toolbar: {
|
||||
title: "Theme",
|
||||
icon: "circlehollow",
|
||||
items: [
|
||||
{ value: "dark", title: "Dark" },
|
||||
{ value: "light", title: "Light" },
|
||||
],
|
||||
dynamicTitle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
parameters: {
|
||||
backgrounds: {
|
||||
default: "canvas",
|
||||
values: [
|
||||
{ name: "canvas", value: "#020302" },
|
||||
{ name: "raised", value: "#0b0d0c" },
|
||||
{ name: "light canvas", value: "#f3f5ed" },
|
||||
{ name: "light raised", value: "#eef1e7" },
|
||||
],
|
||||
},
|
||||
controls: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue