Skip to content

Commit c58aeb6

Browse files
committed
Fix clashing gradient ids
1 parent 16e7acc commit c58aeb6

File tree

1 file changed

+9
-6
lines changed
  • apps/components_guide_web/lib/components_guide_web/live

1 file changed

+9
-6
lines changed

apps/components_guide_web/lib/components_guide_web/live/color.ex

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,22 @@ defmodule ComponentsGuideWeb.ColorLive do
8888
l_gradient_svg =
8989
Styling.svg_linear_gradient(
9090
"rotate(45)",
91-
for(n <- 0..gradient_steps, do: {:lab, interpolate(n / gradient_steps, {0.0, 100.0}), a, b})
91+
for(n <- 0..gradient_steps, do: {:lab, interpolate(n / gradient_steps, {0.0, 100.0}), a, b}),
92+
"lab-l-gradient"
9293
)
9394

9495
a_gradient_svg =
9596
Styling.svg_linear_gradient(
9697
"rotate(45)",
97-
for(n <- 0..gradient_steps, do: {:lab, l, interpolate(n / gradient_steps, {-127.0, 127.0}), b})
98+
for(n <- 0..gradient_steps, do: {:lab, l, interpolate(n / gradient_steps, {-127.0, 127.0}), b}),
99+
"lab-a-gradient"
98100
)
99101

100102
b_gradient_svg =
101103
Styling.svg_linear_gradient(
102104
"rotate(45)",
103-
for(n <- 0..gradient_steps, do: {:lab, l, a, interpolate(n / gradient_steps, {-127.0, 127.0})})
105+
for(n <- 0..gradient_steps, do: {:lab, l, a, interpolate(n / gradient_steps, {-127.0, 127.0})}),
106+
"lab-b-gradient"
104107
)
105108

106109
~L"""
@@ -113,21 +116,21 @@ defmodule ComponentsGuideWeb.ColorLive do
113116
<defs>
114117
<%= l_gradient_svg %>
115118
</defs>
116-
<rect width="1" height="1" fill="url('#myGradient')" />
119+
<rect width="1" height="1" fill="url('#lab-l-gradient')" />
117120
<circle data-drag-knob cx="<%= l / 100.0 %>" cy="<%= l / 100.0 %>" r="0.05" fill="white" stroke="black" stroke-width="0.01" />
118121
</svg>
119122
<svg viewBox="0 0 1 1" width="<%= swatch_size %>" height="<%= swatch_size %>" phx-hook=SwatchInput data-color-property=a>
120123
<defs>
121124
<%= a_gradient_svg %>
122125
</defs>
123-
<rect width="1" height="1" fill="url('#myGradient')" />
126+
<rect width="1" height="1" fill="url('#lab-a-gradient')" />
124127
<circle cx="<%= (a / 127.0) / 2.0 + 0.5 %>" cy="<%= (a / 127.0) / 2.0 + 0.5 %>" r="0.05" fill="white" stroke="black" stroke-width="0.01" />
125128
</svg>
126129
<svg viewBox="0 0 1 1" width="<%= swatch_size %>" height="<%= swatch_size %>" phx-hook=SwatchInput data-color-property=b>
127130
<defs>
128131
<%= b_gradient_svg %>
129132
</defs>
130-
<rect width="1" height="1" fill="url('#myGradient')" />
133+
<rect width="1" height="1" fill="url('#lab-b-gradient')" />
131134
<circle cx="<%= (b / 127.0) / 2.0 + 0.5 %>" cy="<%= (b / 127.0) / 2.0 + 0.5 %>" r="0.05" fill="white" stroke="black" stroke-width="0.01" />
132135
</svg>
133136
</div>

0 commit comments

Comments
 (0)