33import * as React from "react"
44import useSWR from "swr"
55
6- import { DEFAULT_CONFIG } from "@/registry/config"
6+ import { DEFAULT_CONFIG , PRESETS } from "@/registry/config"
77import { useDesignSystemSearchParams } from "@/app/(app)/create/lib/search-params"
88
99const RESET_DIALOG_KEY = "create:reset-dialog-open"
@@ -20,22 +20,27 @@ export function useReset() {
2020 } )
2121
2222 const reset = React . useCallback ( ( ) => {
23+ const preset =
24+ PRESETS . find (
25+ ( preset ) => preset . base === params . base && preset . style === params . style
26+ ) ?? DEFAULT_CONFIG
27+
2328 setParams ( {
2429 base : params . base ,
25- style : DEFAULT_CONFIG . style ,
26- baseColor : DEFAULT_CONFIG . baseColor ,
27- theme : DEFAULT_CONFIG . theme ,
28- chartColor : DEFAULT_CONFIG . chartColor ,
29- iconLibrary : DEFAULT_CONFIG . iconLibrary ,
30- font : DEFAULT_CONFIG . font ,
31- fontHeading : DEFAULT_CONFIG . fontHeading ,
32- menuAccent : DEFAULT_CONFIG . menuAccent ,
33- menuColor : DEFAULT_CONFIG . menuColor ,
34- radius : DEFAULT_CONFIG . radius ,
30+ style : params . style ,
31+ baseColor : preset . baseColor ,
32+ theme : preset . theme ,
33+ chartColor : preset . chartColor ,
34+ iconLibrary : preset . iconLibrary ,
35+ font : preset . font ,
36+ fontHeading : preset . fontHeading ,
37+ menuAccent : preset . menuAccent ,
38+ menuColor : preset . menuColor ,
39+ radius : preset . radius ,
3540 template : DEFAULT_CONFIG . template ,
3641 item : params . item ,
3742 } )
38- } , [ setParams , params . base , params . item ] )
43+ } , [ setParams , params . base , params . style , params . item ] )
3944
4045 const handleShowResetDialogChange = React . useCallback (
4146 ( open : boolean ) => {
0 commit comments