mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Both old names are owned by a different npm account (artemis-prime), so publishing them returns 403 — which is how this surfaced: the 8.0.0 run shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a version that cannot be published and therefore does not exist. Those two were uninstallable. @hanzo/gui and @hanzogui/* are ours, so the framework now carries the name it is imported by everywhere downstream, and the loader moves under the scope we control. The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')` is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting either would change behaviour, so both are untouched. Co-authored-by: Hanzo Dev <[email protected]>
116 lines
2.8 KiB
TypeScript
116 lines
2.8 KiB
TypeScript
import { Check } from '@hanzogui/lucide-icons-2'
|
|
import { Checkbox, H4, Label, Paragraph, Spacer, XStack, YStack } from '@hanzo/gui'
|
|
|
|
import { useRootStore } from '../../../state/useGlobalState'
|
|
import { StudioNotice } from '~/features/studio/StudioNotice'
|
|
import { useThemeBuilderStore } from '~/features/studio/theme/store/ThemeBuilderStore'
|
|
|
|
export function StepSchemes() {
|
|
const rootStore = useRootStore()
|
|
const store = useThemeBuilderStore()
|
|
|
|
return (
|
|
<YStack flex={1} my="$4" gap="$4">
|
|
<H4>Dark and light schemes</H4>
|
|
|
|
<Paragraph size="$5" color="$color10">
|
|
At the base of your themes we recommend a light and dark theme, but you can choose
|
|
just one.
|
|
</Paragraph>
|
|
|
|
<XStack gap="$3">
|
|
<Option
|
|
onChange={(val) => {
|
|
store.setSelectedScheme('light', val)
|
|
// if turning off light, set root store to dark
|
|
if (!val) {
|
|
rootStore.theme = 'dark'
|
|
}
|
|
}}
|
|
label="Light"
|
|
value="light"
|
|
id="light"
|
|
active={store.schemes.light}
|
|
/>
|
|
<Option
|
|
onChange={(val) => {
|
|
// if turning off dark, set root store to light
|
|
store.setSelectedScheme('dark', val)
|
|
if (!val) {
|
|
rootStore.theme = 'light'
|
|
}
|
|
}}
|
|
label="Dark"
|
|
value="dark"
|
|
id="dark"
|
|
active={store.schemes.dark}
|
|
/>
|
|
</XStack>
|
|
|
|
<Spacer flex={1} />
|
|
|
|
<StudioNotice>
|
|
Gui auto-generates media queries on the web using prefers-color-scheme.
|
|
</StudioNotice>
|
|
</YStack>
|
|
)
|
|
}
|
|
|
|
const Option = ({
|
|
id,
|
|
active,
|
|
onChange,
|
|
value,
|
|
label,
|
|
description,
|
|
}: {
|
|
id: string
|
|
description?: string
|
|
label: string
|
|
value?: any
|
|
active?: boolean
|
|
onChange: (next: boolean) => void
|
|
}) => {
|
|
return (
|
|
<Label
|
|
flex={1}
|
|
htmlFor={id}
|
|
p="$3"
|
|
display="flex"
|
|
borderWidth={1}
|
|
theme={active ? 'blue' : null}
|
|
bg={active ? '$color3' : '$color2'}
|
|
borderColor={active ? '$color6' : '$color7'}
|
|
rounded="$5"
|
|
gap="$4"
|
|
items="center"
|
|
hoverStyle={{
|
|
borderColor: active ? '$color6' : '$color8',
|
|
}}
|
|
>
|
|
<Checkbox
|
|
checked={active ?? false}
|
|
onCheckedChange={onChange}
|
|
id={id}
|
|
size="$6"
|
|
value={value}
|
|
>
|
|
<Checkbox.Indicator
|
|
// backgroundColor={active ? '$color8' : '$color1'}
|
|
>
|
|
<Check />
|
|
</Checkbox.Indicator>
|
|
</Checkbox>
|
|
|
|
<YStack gap="$2" flex={1}>
|
|
<Paragraph size="$5">{label}</Paragraph>
|
|
{!!description && (
|
|
<Paragraph size="$3" lineHeight="$1" color="$color9">
|
|
{description}
|
|
</Paragraph>
|
|
)}
|
|
</YStack>
|
|
</Label>
|
|
)
|
|
}
|