Skip to content

Commit

Permalink
deps: update mbta_metro to minor version 1 (#2292)
Browse files Browse the repository at this point in the history
* deps: update mbta_metro

* merge the themes

* maybe fix this import

* fix regression

* another button!
  • Loading branch information
thecristen authored Dec 27, 2024
1 parent be631dd commit 5c1ca76
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 76 deletions.
2 changes: 2 additions & 0 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
--tw-content: '' !important;
}

@import "../../deps/mbta_metro/priv/static/assets/variables.light.css" (prefers-color-scheme: light);
@import "../../deps/mbta_metro/priv/static/assets/variables.dark.css" (prefers-color-scheme: dark);
@import '../../deps/mbta_metro/priv/static/assets/default.css';

////////////////////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 7 additions & 0 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 29 additions & 46 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,35 @@
// https://tailwindcss.com/docs/configuration

const plugin = require("tailwindcss/plugin");
const { content, plugins, safelist } = require("mbta_metro");
const { theme: tailwindTheme } = require("mbta_metro/tailwindTheme");

const {
colors,
content,
fontFamily,
plugins,
safelist
} = require("mbta_metro");
const moreColors = {
...tailwindTheme.colors,
gray: {
DEFAULT: "#494f5c",
dark: "#1c1e23",
light: "#788093",
lighter: "#b0b5c0",
lightest: "#e9eaed",
"bordered-background": "#f2f3f5"
},
"brand-primary": {
DEFAULT: "#165c96",
darkest: "#0b2f4c",
lightest: "#cee0f4"
},
"logan-express": {
BB: "#f16823",
BT: "#0066cc",
DV: "#704c9f",
FH: "#e81d2d",
WO: "#00954c"
},
massport: "#104c8f",
subway: "#494f5c"
};
tailwindTheme.colors = moreColors;

module.exports = {
corePlugins: {
Expand All @@ -31,45 +52,7 @@ module.exports = {
}
],
theme: {
extend: {
colors: {
...colors,
gray: {
DEFAULT: "#494f5c",
dark: "#1c1e23",
light: "#788093",
lighter: "#b0b5c0",
lightest: "#e9eaed",
"bordered-background": "#f2f3f5"
},
"brand-primary": {
DEFAULT: "#165c96",
darkest: "#0b2f4c",
lightest: "#cee0f4"
},
"logan-express": {
BB: "#f16823",
BT: "#0066cc",
DV: "#704c9f",
FH: "#e81d2d",
WO: "#00954c"
},
massport: "#104c8f",
subway: "#494f5c",
// These will come from the design system someday
"blue-line": "#003da5",
"green-line": "#00843d",
"orange-line": "#ed8b00",
"red-line": "#da291c",
"silver-line": "#7c878e",
"commuter-rail": "#80276c",
bus: "#ffc72c",
ferry: "#008eaa"
}
},
fontFamily: {
...fontFamily
},
extend: tailwindTheme,
// match screens to Bootstrap's breakpoints for now
// matched from $container-max-widths
screens: {
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/components/route_symbols.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule DotcomWeb.Components.RouteSymbols do
route_class =
if(Routes.Route.silver_line?(assigns.route),
do: "bg-silver-line text-white",
else: "bg-bus text-black"
else: "bg-brand-bus text-black"
)

assigns = update(assigns, :class, &"#{&1} #{route_class}")
Expand Down
31 changes: 6 additions & 25 deletions lib/dotcom_web/components/trip_planner/itinerary_detail.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,22 @@ defmodule DotcomWeb.Components.TripPlanner.ItineraryDetail do
<div :if={Enum.count(@itineraries) > 1}>
<p class="text-sm mb-2 mt-3">Depart at</p>
<div id="itinerary-detail-departure-times" class="flex flex-wrap gap-2">
<.depart_at_button
<.button
:for={{itinerary, index} <- Enum.with_index(@itineraries)}
active={@itinerary_selection == index}
type="button"
class={if(@itinerary_selection == index, do: "bg-brand-primary-lightest")}
size="small"
variant="secondary"
phx-click="select_itinerary"
phx-value-index={index}
>
{Timex.format!(itinerary.start, "%-I:%M%p", :strftime)}
</.depart_at_button>
</.button>
</div>
</div>
"""
end

attr :active, :boolean
attr :rest, :global
slot :inner_block

defp depart_at_button(%{active: active} = assigns) do
background_class = if active, do: "bg-brand-primary-lightest", else: "bg-transparent"
assigns = assign(assigns, :background_class, background_class)

~H"""
<button
type="button"
class={[
"border border-brand-primary rounded px-2.5 py-1.5 text-brand-primary text-lg",
"hover:bg-brand-primary-lightest #{@background_class}"
]}
{@rest}
>
{render_slot(@inner_block)}
</button>
"""
end

defp specific_itinerary_detail(assigns) do
assigns =
assigns
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ defmodule DotCom.Mixfile do
{:crc, "0.10.5"},
{:credo, "1.7.8", only: [:dev, :test]},
{:csv, "3.2.1"},
{:cva, "0.2.1"},
{:cva, "0.2.2"},
{:decorator, "1.4.0"},
{:dialyxir, "1.4.4", [only: [:dev, :test], runtime: false]},
{:diskusage_logger, "0.2.0"},
Expand Down Expand Up @@ -106,7 +106,7 @@ defmodule DotCom.Mixfile do
{:jason, "1.4.4", override: true},
{:logster, "1.1.1"},
{:mail, "0.3.1"},
{:mbta_metro, "0.0.65"},
{:mbta_metro, "0.1.11"},
{:mock, "0.3.8", [only: :test]},
{:mox, "1.2.0", [only: :test]},
{:nebulex, "2.6.4"},
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"crc": {:hex, :crc, "0.10.5", "ee12a7c056ac498ef2ea985ecdc9fa53c1bfb4e53a484d9f17ff94803707dfd8", [:mix, :rebar3], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3e673b6495a9525c5c641585af1accba59a1eb33de697bedf341e247012c2c7f"},
"credo": {:hex, :credo, "1.7.8", "9722ba1681e973025908d542ec3d95db5f9c549251ba5b028e251ad8c24ab8c5", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cb9e87cc64f152f3ed1c6e325e7b894dea8f5ef2e41123bd864e3cd5ceb44968"},
"csv": {:hex, :csv, "3.2.1", "6d401f1ed33acb2627682a9ab6021e96d33ca6c1c6bccc243d8f7e2197d032f5", [:mix], [], "hexpm", "8f55a0524923ae49e97ff2642122a2ce7c61e159e7fe1184670b2ce847aee6c8"},
"cva": {:hex, :cva, "0.2.1", "fe8acf9c6031714c9b671d80fc7728bd1cc9f5df7708669cdb9682856d352f71", [:mix], [{:phoenix_live_view, "~> 0.18", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "f913a0367e1aed19df18fbfd0672e0abf48b1ac387432b9b4c32883cd4b0341d"},
"cva": {:hex, :cva, "0.2.2", "19ff3fe93c796250f2a3946930e5be62e73019e927aa21c70fcd3c64e9b58466", [:mix], [{:phoenix_live_view, ">= 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "cb494f3df0bf4a8c1b3652d052d0c4dc5111ef6981f542cc22210f639bfbfcda"},
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
"decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"},
"dialyxir": {:hex, :dialyxir, "1.4.4", "fb3ce8741edeaea59c9ae84d5cec75da00fa89fe401c72d6e047d11a61f65f70", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "cd6111e8017ccd563e65621a4d9a4a1c5cd333df30cebc7face8029cacb4eff6"},
Expand Down Expand Up @@ -55,7 +55,7 @@
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
"makeup_html": {:hex, :makeup_html, "0.1.2", "19d4050c0978a4f1618ffe43054c0049f91fe5feeb9ae8d845b5dc79c6008ae5", [:mix], [{:makeup, "~> 1.2", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "b7fb9afedd617d167e6644a0430e49c1279764bfd3153da716d4d2459b0998c5"},
"mbta_metro": {:hex, :mbta_metro, "0.0.65", "add029569a8e386f66c08d001e7fb11a14e26c2308e3f47a14baebde4822769c", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: false]}, {:heroicons, "0.5.6", [hex: :heroicons, repo: "hexpm", optional: true]}, {:jason, "1.4.4", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "1.7.14", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_live_view, "1.0.0-rc.6", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:phoenix_storybook, "0.6.4", [hex: :phoenix_storybook, repo: "hexpm", optional: false]}, {:timex, "3.7.11", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm", "22b4488c60c48b5638a617a8375fe2c3f27dd9b37452669c00f7a0d55abe7157"},
"mbta_metro": {:hex, :mbta_metro, "0.1.11", "1ab2cfef7e80594e9f5d3d3239b16e6061cba7b09e893a3ec49c80073422c446", [:mix], [{:cva, "0.2.2", [hex: :cva, repo: "hexpm", optional: false]}, {:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: false]}, {:heroicons, "0.5.6", [hex: :heroicons, repo: "hexpm", optional: true]}, {:jason, "1.4.4", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "1.7.14", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_live_view, "1.0.0-rc.6", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:phoenix_storybook, "0.6.4", [hex: :phoenix_storybook, repo: "hexpm", optional: false]}, {:timex, "3.7.11", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm", "99c31966dc0322a171e3715dcbbc41b185998dc0f1ded906b0d4680f1b9ac19b"},
"meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"},
Expand Down

0 comments on commit 5c1ca76

Please sign in to comment.