Skip to content

Commit

Permalink
fix: Restore accessibility icons
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlarson committed Dec 18, 2024
1 parent 6b39b2d commit 732984f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 13 additions & 3 deletions lib/dotcom_web/components/trip_planner/place.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule DotcomWeb.Components.TripPlanner.Place do

attr :name, :string, required: true
attr :time, :any, required: true
attr :accessible, :boolean, default: false
slot :icon

def place(assigns) do
Expand All @@ -15,9 +16,18 @@ defmodule DotcomWeb.Components.TripPlanner.Place do
<div class="flex flex-col items-center">
{render_slot(@icon)}
</div>
<div class="flex flex-col justify-start">
<strong class="text-sm">{@name}</strong>
</div>
<strong class="text-sm">
{@name}
<.icon
:if={@accessible}
type="icon-svg"
name="icon-accessible-default"
class="h-3 w-3 shrink-0 ml-1.5"
aria-hidden="true"
/>
</strong>
<time class="ml-auto text-right text-sm text-nowrap">{format_time(@time)}</time>
</div>
"""
Expand Down
8 changes: 6 additions & 2 deletions lib/dotcom_web/components/trip_planner/transit_leg.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ defmodule DotcomWeb.Components.TripPlanner.TransitLeg do

use Phoenix.Component

# import DotcomWeb.Components.TripPlanner.AlertGroup, only: [alert_group: 1]
import DotcomWeb.Components.RouteSymbols, only: [route_symbol: 1]
import DotcomWeb.Components.TripPlanner.Place
import MbtaMetro.Components.Icon, only: [icon: 1]
import Routes.Route, only: [is_external?: 1, is_shuttle?: 1]

alias Dotcom.TripPlan.{Alerts, TransitDetail}
alias Routes.Route
alias Stops.Stop

@doc """
Renders a transit leg.
Expand Down Expand Up @@ -85,7 +85,11 @@ defmodule DotcomWeb.Components.TripPlanner.TransitLeg do
defp transit_place(assigns) do
~H"""
<div>
<.place time={@time} name={@place.stop.name}>
<.place
time={@time}
name={@place.stop.name}
accessible={!is_nil(@place.stop) and Stop.accessible?(@place.stop)}
>
<:icon>
<div class="h-5 w-5">
<.transit_leg_icon route={@route} />
Expand Down

0 comments on commit 732984f

Please sign in to comment.