Skip to content

Commit b948a1d

Browse files
committed
Add dev calendar to home page
1 parent 62a80fa commit b948a1d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/components_guide_web/components/dev_calendar_component.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,18 @@ defmodule ComponentsGuideWeb.DevCalendarComponent do
55

66
def calendar(assigns \\ %{}) do
77
today = Date.utc_today()
8-
98
%{dates_to_items: dates_to_items, links: links} = get_data()
109

11-
calendar_extra = fn date ->
12-
yymmdd = Date.to_erl(date)
13-
14-
ids = Map.get(dates_to_items, yymmdd, [])
15-
icon_links(ids, links)
16-
end
17-
1810
assigns = %{
1911
today: today,
20-
calendar_extra: calendar_extra,
12+
dates_to_items: dates_to_items,
2113
links: links
2214
}
2315

2416
~H"""
2517
<CalendarComponent.calendar_grid current_date={@today}>
2618
<:cell_content :let={date}>
27-
<%= @calendar_extra.(date) %>
19+
<.date_links date={date} dates_to_items={@dates_to_items} links={@links} />
2820
</:cell_content>
2921
</CalendarComponent.calendar_grid>
3022
"""
@@ -108,6 +100,13 @@ defmodule ComponentsGuideWeb.DevCalendarComponent do
108100
end
109101
end
110102

103+
defp date_links(assigns) do
104+
yymmdd = Date.to_erl(assigns.date)
105+
106+
ids = Map.get(assigns.dates_to_items, yymmdd, [])
107+
icon_links(ids, assigns.links)
108+
end
109+
111110
defp icon_links(ids, links) do
112111
assigns = %{ids: ids}
113112

@@ -480,6 +479,7 @@ defmodule ComponentsGuideWeb.DevCalendarComponent do
480479
firefox106: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/106",
481480
firefox107: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/107",
482481
firefox108: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/108",
482+
firefox109: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/109",
483483
swift5_6: "https://www.swift.org/blog/swift-5.6-released/",
484484
swift5_7: "https://www.swift.org/blog/swift-5.7-released/",
485485
safari15_4: "https://webkit.org/blog/12445/new-webkit-features-in-safari-15-4/",

0 commit comments

Comments
 (0)