fix(create): preserve settings when changing style (#10680)

This commit is contained in:
shadcn
2026-05-17 12:31:37 +04:00
committed by GitHub
parent 36139f6200
commit d1149454a8

View File

@@ -2,7 +2,7 @@
import * as React from "react"
import { PRESETS, type Style, type StyleName } from "@/registry/config"
import { type Style, type StyleName } from "@/registry/config"
import { LockButton } from "@/app/(app)/create/components/lock-button"
import {
Picker,
@@ -53,24 +53,7 @@ export function StylePicker({
<PickerRadioGroup
value={currentStyle?.name}
onValueChange={(value) => {
const styleName = value as StyleName
const preset = PRESETS.find(
(p) => p.base === params.base && p.style === styleName
)
setParams({
style: styleName,
...(preset && {
baseColor: preset.baseColor,
theme: preset.theme,
chartColor: preset.chartColor,
iconLibrary: preset.iconLibrary,
font: preset.font,
fontHeading: preset.fontHeading,
menuAccent: preset.menuAccent,
menuColor: preset.menuColor,
radius: preset.radius,
}),
})
setParams({ style: value as StyleName })
}}
>
<PickerGroup>