Skip to content

Commit b346f4b

Browse files
committed
Purple
1 parent 40670e4 commit b346f4b

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

apps/components_guide_web/lib/components_guide_web/controllers/graphics_controller.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ defmodule ComponentsGuideWeb.GraphicsView do
2121
alias ComponentsGuideWeb.ThemeView
2222

2323
def header_styles() do
24-
ThemeView.banner_styles(:web_standards)
24+
ThemeView.banner_styles(:graphics)
2525
end
2626
end

apps/components_guide_web/lib/components_guide_web/templates/graphics/postage_stamp_live.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ defmodule ComponentsGuideWeb.Graphics.Live.PostageStamp do
44
alias ComponentsGuideWeb.StylingHelpers
55

66
defmodule State do
7-
defstruct primary: "Primary", secondary: "Secondary", width: 400, height: 400, center_y: false
7+
defstruct primary: "Primary", secondary: "Secondary", width: 400, height: 400, center_y: false, center_x: true
88

9-
def to_url(%State{primary: primary, secondary: secondary, width: width, height: height, center_y: center_y}) do
9+
def to_url(%State{primary: primary, secondary: secondary, width: width, height: height, center_y: center_y, center_x: center_x}) do
1010
# url = URI.parse("https://postage-stamp.collected.workers.dev/1/poster")
1111
url = URI.parse("https://postage-stamp.fly.dev/1/poster")
1212
query = [primary: primary, secondary: secondary, width: width, height: height]
1313
query = if center_y, do: Keyword.put(query, :centerY, ""), else: query
14+
query = if center_x, do: Keyword.put(query, :centerX, ""), else: query
1415
url = put_in(url.query, URI.encode_query(query))
1516
url
1617
end
@@ -52,7 +53,7 @@ defmodule ComponentsGuideWeb.Graphics.Live.PostageStamp do
5253
5354
<output>
5455
<img src="<%= url |> URI.to_string() %>" width="<%= @state.width %>" height="<%= @state.height %>">
55-
<a class="inline-block bg-blue-500 rounded-full" href="<%= url |> URI.to_string() %>">Link to image</a>
56+
<a class="inline-block px-2 bg-blue-500 rounded-full" href="<%= url |> URI.to_string() %>">Link to image</a>
5657
</output>
5758
5859
</div>

apps/components_guide_web/lib/components_guide_web/views/theme_view.ex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,29 @@ defmodule ComponentsGuideWeb.ThemeView do
6666

6767
"background-color: #{color |> Styling.to_css()}; background-image: #{gradient};"
6868
end
69+
70+
defp gradient_styles(:purple) do
71+
l = 50
72+
a = 54
73+
b = -85
74+
75+
color = {:lab, l, a, b}
76+
77+
gradient = Styling.linear_gradient("150grad", [
78+
{:lab, l * 1.5, a * 0.7, b * 2},
79+
{:lab, l * 1.3, a * 0.8, b * 1.6},
80+
{:lab, l * 1.1, a * 0.9, b * 1.2},
81+
color,
82+
{:lab, l * 0.9, a * 1.3, b * 0.7},
83+
{:lab, l * 0.8, a * 1.7, b * 0.5},
84+
])
85+
86+
"background-color: #{color |> Styling.to_css()}; background-image: #{gradient};"
87+
end
6988

7089
def banner_styles(:accessibility_first), do: gradient_styles(:cool_pink)
7190
def banner_styles(:web_standards), do: gradient_styles(:green)
7291
def banner_styles(:composable_systems), do: gradient_styles(:orange)
7392
def banner_styles(:react_typescript), do: gradient_styles(:blue)
93+
def banner_styles(:graphics), do: gradient_styles(:purple)
7494
end

0 commit comments

Comments
 (0)