Files
shadcn-ui/apps/www/components/style-switcher.tsx
shadcn 7590fb7636 feat: lift mode (#3380)
* feat(www): wip break everything

* feat(www): wip chunks

* feat(www): wip chunk mode

* feat: lift mode

* feat: update chunks

* fix: resize in lift mode

* fix: hasLiftMode

* fix: types

* fix: toolbar

Thanks @mrnbpt

* chore: format check

* feat: add tracking for enable_lift_mode

* chore: format write

* docs: add changelog
2024-04-05 21:28:05 +04:00

50 lines
1.2 KiB
TypeScript

"use client"
import * as React from "react"
import { type SelectTriggerProps } from "@radix-ui/react-select"
import { cn } from "@/lib/utils"
import { useConfig } from "@/hooks/use-config"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/registry/new-york/ui/select"
import { Style, styles } from "@/registry/styles"
export function StyleSwitcher({ className, ...props }: SelectTriggerProps) {
const [config, setConfig] = useConfig()
return (
<Select
value={config.style}
onValueChange={(value: Style["name"]) =>
setConfig({
...config,
style: value,
})
}
>
<SelectTrigger
className={cn(
"h-7 w-[145px] text-xs [&_svg]:h-4 [&_svg]:w-4",
className
)}
{...props}
>
<span className="text-muted-foreground">Style: </span>
<SelectValue placeholder="Select style" />
</SelectTrigger>
<SelectContent>
{styles.map((style) => (
<SelectItem key={style.name} value={style.name} className="text-xs">
{style.label}
</SelectItem>
))}
</SelectContent>
</Select>
)
}