|
7 | 7 | import MinusIcon from "$playground/components/icons/minus-icon.svelte"; |
8 | 8 | import PlusIcon from "$playground/components/icons/plus-icon.svelte"; |
9 | 9 | import { config } from "$playground/config.svelte"; |
10 | | - import { AUTO_PANEL_MAX_HEIGHT, defaults, ranges } from "$playground/defaults"; |
| 10 | + import { defaults, ranges } from "$playground/defaults"; |
11 | 11 | import { configSnippet } from "$playground/snippet"; |
12 | 12 | import type { Swatch } from "$playground/types"; |
13 | 13 |
|
|
68 | 68 | <span class="truncate text-sm font-semibold">Customize</span> |
69 | 69 | <span class="truncate text-xs text-zinc-400 light:text-zinc-600">Changes apply live</span> |
70 | 70 | </div> |
| 71 | + {#if dirty} |
| 72 | + <button |
| 73 | + type="button" |
| 74 | + onclick={reset} |
| 75 | + class="focus-ring flex h-7 shrink-0 cursor-pointer items-center rounded-md border border-zinc-700 px-2.5 text-xs light:border-zinc-300" |
| 76 | + > |
| 77 | + Reset |
| 78 | + </button> |
| 79 | + {/if} |
71 | 80 | </header> |
72 | 81 |
|
73 | 82 | <div class="panel-scroll mb-4 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4 pb-0"> |
|
82 | 91 | onSelect={(theme) => (config.theme = theme)} |
83 | 92 | /> |
84 | 93 |
|
85 | | - <ControlSegmented |
86 | | - label="Initial state" |
87 | | - options={[ |
88 | | - { value: "docked", label: "Docked" }, |
89 | | - { value: "open", label: "Open" } |
90 | | - ]} |
91 | | - value={config.initialState} |
92 | | - onSelect={(initialState) => (config.initialState = initialState)} |
93 | | - /> |
94 | | - |
95 | | - <ControlSegmented |
96 | | - label="Dock side" |
97 | | - options={[ |
98 | | - { value: "left", label: "Left" }, |
99 | | - { value: "right", label: "Right" } |
100 | | - ]} |
101 | | - value={config.side} |
102 | | - onSelect={(side) => (config.side = side)} |
103 | | - /> |
104 | | - |
105 | 94 | <div class="flex flex-col gap-1.5"> |
106 | 95 | <span class="text-xs text-zinc-400 light:text-zinc-600">Accent</span> |
107 | 96 | <div class="flex flex-wrap items-center gap-2"> |
|
155 | 144 | </div> |
156 | 145 | </div> |
157 | 146 |
|
| 147 | + <ControlSegmented |
| 148 | + label="Initial state" |
| 149 | + options={[ |
| 150 | + { value: "docked", label: "Docked" }, |
| 151 | + { value: "open", label: "Open" } |
| 152 | + ]} |
| 153 | + value={config.initialState} |
| 154 | + onSelect={(initialState) => (config.initialState = initialState)} |
| 155 | + /> |
| 156 | + |
| 157 | + <ControlSegmented |
| 158 | + label="Initial dock side" |
| 159 | + options={[ |
| 160 | + { value: "left", label: "Left" }, |
| 161 | + { value: "right", label: "Right" } |
| 162 | + ]} |
| 163 | + value={config.side} |
| 164 | + onSelect={(side) => (config.side = side)} |
| 165 | + /> |
| 166 | + |
158 | 167 | <ControlSlider |
159 | 168 | label="Dock vertical" |
160 | 169 | min={ranges.vertical.min} |
|
181 | 190 | max={ranges.panelMaxHeight.max} |
182 | 191 | step={ranges.panelMaxHeight.step} |
183 | 192 | value={config.panelMaxHeight} |
184 | | - format={(v) => (v === AUTO_PANEL_MAX_HEIGHT ? "Auto" : `${v}px`)} |
| 193 | + format={(v) => `${v}%`} |
185 | 194 | onCommit={(v) => (config.panelMaxHeight = v)} |
186 | 195 | /> |
187 | 196 |
|
|
214 | 223 | <span class="flex items-center justify-between"> |
215 | 224 | <span class="text-xs text-zinc-400 light:text-zinc-600">Your config</span> |
216 | 225 | <span class="flex items-center gap-2"> |
217 | | - {#if dirty} |
218 | | - <button |
219 | | - type="button" |
220 | | - onclick={reset} |
221 | | - class="focus-ring flex h-6 cursor-pointer items-center rounded-md border border-zinc-700 px-2 text-xs light:border-zinc-300" |
222 | | - > |
223 | | - Reset |
224 | | - </button> |
225 | | - {/if} |
226 | 226 | <button |
227 | 227 | type="button" |
228 | 228 | aria-label="Copy config" |
|
0 commit comments