diff --git a/assets/css/_homepage.scss b/assets/css/_homepage.scss index 80564caf50..4dc7d5b845 100644 --- a/assets/css/_homepage.scss +++ b/assets/css/_homepage.scss @@ -12,31 +12,12 @@ } } -.m-homepage__shortcuts { - column-gap: 3.125%; - display: grid; - grid-template-columns: repeat(5, 1fr); - grid-template-rows: auto; - justify-items: stretch; - margin-top: 24px; - - @include media-breakpoint-down(xs) { - column-gap: 3.125%; - grid-template-columns: repeat(3, 1fr); - grid-template-rows: repeat(2, 1fr); - } -} - .m-homepage__shortcut { @include icon-size(80px); background-color: $white; border: $border; border-radius: .5rem; color: $gray-dark; - display: inline-block; - font-size: $font-size-h4; - font-weight: 700; - line-height: $headings-line-height; padding: $base-spacing; text-align: center; @@ -52,7 +33,6 @@ @include media-breakpoint-only(xs) { @include icon-size(40px); - margin-bottom: math.div($base-spacing, 2); padding: $space-12; } diff --git a/lib/dotcom_web/components/system_status/subway_status.ex b/lib/dotcom_web/components/system_status/subway_status.ex index 94bb67f2ad..de07212cfe 100644 --- a/lib/dotcom_web/components/system_status/subway_status.ex +++ b/lib/dotcom_web/components/system_status/subway_status.ex @@ -14,7 +14,7 @@ defmodule DotcomWeb.Components.SystemStatus.SubwayStatus do attr :subway_status, :any, required: true - def subway_status(assigns) do + def homepage_subway_status(assigns) do assigns = assigns |> assign(:rows, status_to_rows(assigns.subway_status)) ~H""" diff --git a/lib/dotcom_web/controllers/page_controller.ex b/lib/dotcom_web/controllers/page_controller.ex index 114dcc5e37..85a4b21150 100644 --- a/lib/dotcom_web/controllers/page_controller.ex +++ b/lib/dotcom_web/controllers/page_controller.ex @@ -15,6 +15,7 @@ defmodule DotcomWeb.PageController do plug(:alerts) plug(DotcomWeb.Plugs.RecentlyVisited) + plug(:subway_status) @type content :: Banner.t() | Teaser.t() | WhatsHappeningItem.t() @type whats_happening_set :: {nil | [WhatsHappeningItem.t()], nil | [WhatsHappeningItem.t()]} @@ -139,4 +140,8 @@ defmodule DotcomWeb.PageController do assign(conn, :alerts, alerts) end + + defp subway_status(conn, _opts) do + assign(conn, :subway_status, Dotcom.SystemStatus.subway_status()) + end end diff --git a/lib/dotcom_web/live/system_status.ex b/lib/dotcom_web/live/system_status.ex index 2f15379e12..4cd447b445 100644 --- a/lib/dotcom_web/live/system_status.ex +++ b/lib/dotcom_web/live/system_status.ex @@ -33,11 +33,9 @@ defmodule DotcomWeb.Live.SystemStatus do |> assign(:statuses, statuses) |> assign(:examples, examples) - Widget - ~H"""

Live Data

- <.subway_status subway_status={@statuses} /> + <.homepage_subway_status subway_status={@statuses} />

Alerts

@@ -48,7 +46,7 @@ defmodule DotcomWeb.Live.SystemStatus do
- <.subway_status subway_status={example.statuses} /> + <.homepage_subway_status subway_status={example.statuses} />
Alerts diff --git a/lib/dotcom_web/templates/page/_tabbed_nav.html.eex b/lib/dotcom_web/templates/page/_tabbed_nav.html.eex deleted file mode 100644 index a92ccb6e94..0000000000 --- a/lib/dotcom_web/templates/page/_tabbed_nav.html.eex +++ /dev/null @@ -1,49 +0,0 @@ - diff --git a/lib/dotcom_web/templates/page/_tabbed_nav.html.heex b/lib/dotcom_web/templates/page/_tabbed_nav.html.heex new file mode 100644 index 0000000000..63d413e56c --- /dev/null +++ b/lib/dotcom_web/templates/page/_tabbed_nav.html.heex @@ -0,0 +1,97 @@ + diff --git a/lib/dotcom_web/views/page_view.ex b/lib/dotcom_web/views/page_view.ex index ff73280029..60a88bed31 100644 --- a/lib/dotcom_web/views/page_view.ex +++ b/lib/dotcom_web/views/page_view.ex @@ -3,6 +3,7 @@ defmodule DotcomWeb.PageView do import PhoenixHTMLHelpers.Tag import DotcomWeb.CMSHelpers import DotcomWeb.CMS.ParagraphView, only: [render_paragraph: 2] + import DotcomWeb.Components.SystemStatus.SubwayStatus, only: [homepage_subway_status: 1] alias CMS.Page.NewsEntry alias CMS.Partial.Banner @@ -143,11 +144,8 @@ defmodule DotcomWeb.PageView do end def shortcut_icons do - icons = - [:commuter_rail, :subway, :bus, :ferry, :the_ride] - |> Enum.map(&shortcut_icon/1) - - content_tag(:div, icons, class: "m-homepage__shortcuts") + [:commuter_rail, :subway, :bus, :ferry, :the_ride] + |> Enum.map(&shortcut_icon/1) end @spec shortcut_icon(atom) :: Phoenix.HTML.Safe.t() diff --git a/test/dotcom_web/views/page_view_test.exs b/test/dotcom_web/views/page_view_test.exs index 08062a1c47..ba1ec2bdd6 100644 --- a/test/dotcom_web/views/page_view_test.exs +++ b/test/dotcom_web/views/page_view_test.exs @@ -43,9 +43,10 @@ defmodule DotcomWeb.PageViewTest do describe "shortcut_icons/0" do test "renders shortcut icons" do - rendered = PageView.shortcut_icons() |> HTML.safe_to_string() - icons = Floki.find(rendered, ".m-homepage__shortcut") + icons = PageView.shortcut_icons() assert length(icons) == 5 + icon = List.first(icons) |> HTML.safe_to_string() + assert icon =~ "