-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add alert info to trip planner output (#2269)
Co-authored-by: Cristen Jones <[email protected]>
- Loading branch information
1 parent
4aabef8
commit c8a86bf
Showing
10 changed files
with
640 additions
and
200 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
defmodule DotcomWeb.Components.TripPlanner.AlertGroup do | ||
@moduledoc """ | ||
A component to display an alert for a route or location | ||
""" | ||
|
||
use DotcomWeb, :component | ||
|
||
attr :alerts, :list, required: true | ||
attr :class, :string, default: "" | ||
|
||
def alert_group(assigns) do | ||
~H""" | ||
<%= if @alerts do %> | ||
<div :for={alert <- @alerts} class={@class}> | ||
<.alert alert={alert} /> | ||
</div> | ||
<% end %> | ||
""" | ||
end | ||
|
||
defp alert(assigns) do | ||
~H""" | ||
<details class="group/alert"> | ||
<summary class="flex items-center gap-1.5 mb-1"> | ||
<.icon name="triangle-exclamation" class="w-3 h-3" /> | ||
<span> | ||
<span class="text-sm">{Phoenix.Naming.humanize(@alert.effect)}</span> | ||
<span class="group-open/alert:hidden cursor-pointer btn-link text-xs">Show Details</span> | ||
<span class="hidden group-open/alert:inline cursor-pointer btn-link text-xs"> | ||
Hide Details | ||
</span> | ||
</span> | ||
</summary> | ||
<div class="bg-white p-2 text-sm"> | ||
{@alert.header} | ||
</div> | ||
</details> | ||
""" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.