30 lines
710 B
Text
30 lines
710 B
Text
package blocks
|
|
|
|
import (
|
|
"git.juancwu.dev/juancwu/budgit/internal/ui/components/button"
|
|
"git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
|
)
|
|
|
|
type ThemeSwitcherProps struct {
|
|
Class string
|
|
}
|
|
|
|
// ThemeSwitcher renders only the UI button.
|
|
// The interactive script is handled globally in the layout.
|
|
templ ThemeSwitcher(props ...ThemeSwitcherProps) {
|
|
{{ var p ThemeSwitcherProps }}
|
|
if len(props) > 0 {
|
|
{{ p = props[0] }}
|
|
}
|
|
@button.Button(button.Props{
|
|
Size: button.SizeIcon,
|
|
Variant: button.VariantGhost,
|
|
Class: p.Class,
|
|
Attributes: templ.Attributes{
|
|
"data-theme-switcher": "true",
|
|
"aria-label": "Toggle theme",
|
|
},
|
|
}) {
|
|
@icon.Eclipse(icon.Props{Size: 20})
|
|
}
|
|
}
|