|
10 | 10 | :modelValue="gradient.type" |
11 | 11 | @update:modelValue="updateType" |
12 | 12 | class="flex-1" /> |
13 | | - <div v-if="gradient.type === 'linear-gradient'" class="flex items-center gap-2"> |
| 13 | + </div> |
| 14 | + |
| 15 | + <div class="flex items-center gap-4"> |
| 16 | + <!-- Gradient Preview / Stop Bar --> |
| 17 | + <div |
| 18 | + class="shadow-inner relative h-5 w-full rounded border border-outline-gray-2" |
| 19 | + :style="barPreviewStyle" |
| 20 | + ref="barRef"> |
| 21 | + <div class="absolute inset-0 cursor-copy" @click.self="addStopAtX"></div> |
| 22 | + <div |
| 23 | + v-for="(stop, index) in gradient.stops" |
| 24 | + :key="index" |
| 25 | + class="absolute top-1/2 z-10 -translate-x-1/2 -translate-y-1/2" |
| 26 | + :style="{ left: stop.position + '%' }"> |
| 27 | + <Popover placement="top" :offset="10"> |
| 28 | + <template #target="{ togglePopover }"> |
| 29 | + <div |
| 30 | + class="size-4 cursor-pointer rounded-full border-2 border-white shadow-md ring-1 ring-black/20 transition-transform hover:scale-110 focus:outline-none" |
| 31 | + :style="{ backgroundColor: stop.color }" |
| 32 | + @mousedown="handleStopMouseDown(index, $event)" |
| 33 | + @click="(e) => !hasMoved && togglePopover()" /> |
| 34 | + </template> |
| 35 | + <template #body="{ close }"> |
| 36 | + <div class="rounded-lg border border-outline-gray-2 bg-surface-white p-3 shadow-xl"> |
| 37 | + <ColorPicker |
| 38 | + renderMode="inline" |
| 39 | + :showInput="true" |
| 40 | + :modelValue="stop.color" |
| 41 | + @update:modelValue="(val) => updateStopColor(index, val)" /> |
| 42 | + <div class="mt-2 flex items-center gap-2"> |
| 43 | + <BuilderButton |
| 44 | + variant="subtle" |
| 45 | + label="Remove Stop" |
| 46 | + class="w-full" |
| 47 | + :disabled="gradient.stops.length <= 2" |
| 48 | + @click=" |
| 49 | + () => { |
| 50 | + close(); |
| 51 | + removeStop(index); |
| 52 | + } |
| 53 | + " /> |
| 54 | + </div> |
| 55 | + </div> |
| 56 | + </template> |
| 57 | + </Popover> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + <div v-if="gradient.type === 'linear-gradient'" class="flex items-center gap-1"> |
14 | 61 | <AnglePicker :modelValue="parseInt(angleValue)" @update:modelValue="updateAngle" /> |
15 | 62 | <Input |
16 | 63 | type="text" |
|
26 | 73 | </div> |
27 | 74 | </div> |
28 | 75 |
|
29 | | - <!-- Gradient Preview / Stop Bar --> |
30 | | - <div |
31 | | - class="shadow-inner relative h-5 w-full rounded border border-outline-gray-2" |
32 | | - :style="barPreviewStyle" |
33 | | - ref="barRef"> |
34 | | - <div class="absolute inset-0 cursor-copy" @click.self="addStopAtX"></div> |
35 | | - <div |
36 | | - v-for="(stop, index) in gradient.stops" |
37 | | - :key="index" |
38 | | - class="absolute top-1/2 z-10 -translate-x-1/2 -translate-y-1/2" |
39 | | - :style="{ left: stop.position + '%' }"> |
40 | | - <Popover placement="top" :offset="10"> |
41 | | - <template #target="{ togglePopover }"> |
42 | | - <div |
43 | | - class="size-4 cursor-pointer rounded-full border-2 border-white shadow-md ring-1 ring-black/20 transition-transform hover:scale-110 focus:outline-none" |
44 | | - :style="{ backgroundColor: stop.color }" |
45 | | - @mousedown="handleStopMouseDown(index, $event)" |
46 | | - @click="(e) => !hasMoved && togglePopover()" /> |
47 | | - </template> |
48 | | - <template #body="{ close }"> |
49 | | - <div class="rounded-lg border border-outline-gray-2 bg-surface-white p-3 shadow-xl"> |
50 | | - <ColorPicker |
51 | | - renderMode="inline" |
52 | | - :showInput="true" |
53 | | - :modelValue="stop.color" |
54 | | - @update:modelValue="(val) => updateStopColor(index, val)" /> |
55 | | - <div class="mt-2 flex items-center gap-2"> |
56 | | - <BuilderButton |
57 | | - variant="subtle" |
58 | | - label="Remove Stop" |
59 | | - class="w-full" |
60 | | - :disabled="gradient.stops.length <= 2" |
61 | | - @click=" |
62 | | - () => { |
63 | | - close(); |
64 | | - removeStop(index); |
65 | | - } |
66 | | - " /> |
67 | | - </div> |
68 | | - </div> |
69 | | - </template> |
70 | | - </Popover> |
71 | | - </div> |
72 | | - </div> |
73 | | - |
74 | 76 | <!-- Presets --> |
75 | 77 | <div class="flex flex-wrap gap-2"> |
76 | 78 | <div |
|
0 commit comments