chore: storybook (#15285)

Co-authored-by: David Hill <iamdavidhill@gmail.com>
This commit is contained in:
Adam
2026-02-26 16:05:04 -06:00
committed by GitHub
parent 8c484a05b8
commit 05d77b7d47
85 changed files with 5407 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
import { createElement } from "react"
import { useGlobals } from "storybook/manager-api"
import { ToggleButton } from "storybook/internal/components"
export function ThemeTool() {
const [globals, updateGlobals] = useGlobals()
const mode = globals.theme === "dark" ? "dark" : "light"
const toggle = () => {
const next = mode === "dark" ? "light" : "dark"
updateGlobals({ theme: next })
}
return createElement(
ToggleButton,
{
title: "Toggle theme",
active: mode === "dark",
onClick: toggle,
},
mode === "dark" ? "Dark" : "Light",
)
}