diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index bc3b00e1fb..10b83e1573 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -57,7 +57,7 @@ module.exports = { ], safelist: [ { - pattern: /(bg|text|border|ring)-(logan-express|blue|green|orange|red|silver|bus|ferry|)./ + pattern: /(bg|text|border|ring|stroke)-(logan-express|blue|green|orange|red|silver|bus|brand-bus|ferry|commuter-rail).*/ } ], theme: { diff --git a/lib/css_helpers.ex b/lib/css_helpers.ex index 67fcdd1be1..e7e3e5adf7 100644 --- a/lib/css_helpers.ex +++ b/lib/css_helpers.ex @@ -50,4 +50,26 @@ defmodule CSSHelpers do "mbta-route-#{String.downcase(route.id)}-line" end end + + @doc """ + Returns a Tailwind stroke color class for a route. + This is used for SVG elements that need stroke colors. + """ + @spec route_to_stroke_class(Route.t()) :: String.t() + def route_to_stroke_class(%Route{type: 3} = route) do + if Route.silver_line?(route) do + "stroke-silver-line" + else + "stroke-brand-bus" + end + end + + def route_to_stroke_class(%Route{type: 2}), do: "stroke-commuter-rail" + def route_to_stroke_class(%Route{type: 4}), do: "stroke-ferry" + def route_to_stroke_class(%Route{id: "Mattapan"}), do: "stroke-red-line" + def route_to_stroke_class(%Route{id: "Red"}), do: "stroke-red-line" + def route_to_stroke_class(%Route{id: "Blue"}), do: "stroke-blue-line" + def route_to_stroke_class(%Route{id: "Orange"}), do: "stroke-orange-line" + def route_to_stroke_class(%Route{id: "Green" <> _}), do: "stroke-green-line" + def route_to_stroke_class(_), do: "stroke-black" end diff --git a/lib/dotcom_web/components/route_components.ex b/lib/dotcom_web/components/route_components.ex index e0fc0643a3..d77af6bd1a 100644 --- a/lib/dotcom_web/components/route_components.ex +++ b/lib/dotcom_web/components/route_components.ex @@ -76,7 +76,7 @@ defmodule DotcomWeb.RouteComponents do attr :variant, :string, default: "default", - values: ["cancelled", "default", "mode", "none"], + values: ["cancelled", "default", "mode", "none", "squiggle"], doc: "Determines what kind of marker gets put on the line. `default` is a small round circle, " <> "`mode` is a larger bus, subway, etc icon, and `none` draws no marker at all." @@ -115,7 +115,10 @@ defmodule DotcomWeb.RouteComponents do attr :background, :string, default: "white", values: ["white", "charcoal-90"] attr :route, Route, required: true - attr :variant, :string, default: "default", values: ["cancelled", "default", "mode", "none"] + + attr :variant, :string, + default: "default", + values: ["cancelled", "default", "mode", "none", "squiggle"] defp lined_list_marker(%{variant: "none"} = assigns) do ~H"" @@ -155,6 +158,19 @@ defmodule DotcomWeb.RouteComponents do """ end + defp lined_list_marker(%{variant: "squiggle"} = assigns) do + ~H""" +
+ +
+ """ + end + defp lined_list_marker(assigns) do ~H"""
- <.lined_list_item route={upcoming_departure.route} variant="none"> + <.lined_list_item + background="charcoal-90" + class="group-open/details:hidden" + route={upcoming_departure.route} + variant="squiggle" + >
- + {~t"Show more stops"} -
+
+ <.icon name="chevron-down" class="h-3 w-3" /> +
+ + <.lined_list_item + background="charcoal-90" + class="hidden group-open/details:flex" + route={upcoming_departure.route} + variant="none" + > +
+ {~t"Show fewer stops"}
- <.icon name="chevron-down" class="h-3 w-3 group-open/details:rotate-180" /> + <.icon name="chevron-down" class="h-3 w-3 rotate-180" />
diff --git a/mix.exs b/mix.exs index ba5e9d40ca..502623bb13 100644 --- a/mix.exs +++ b/mix.exs @@ -127,7 +127,6 @@ defmodule DotCom.Mixfile do {:logster, "1.1.1"}, # reverted from 0.4 {:mail, "0.3.1"}, - # {:mbta_metro, path: "../mbta_metro", runtime: false}, {:mbta_metro, "1.1.2", runtime: false}, {:mock, "0.3.9", [only: :test]}, {:mox, "1.2.0", [only: [:dev, :test]]}, diff --git a/priv/static/icon-svg/icon-squiggle.svg b/priv/static/icon-svg/icon-squiggle.svg new file mode 100644 index 0000000000..eb1fc87e07 --- /dev/null +++ b/priv/static/icon-svg/icon-squiggle.svg @@ -0,0 +1,37 @@ + + + + + +