From a78995c6cf5b642b1e9484ff12ff64b664a9cac1 Mon Sep 17 00:00:00 2001 From: Nuno Miguel <30806591+nunom27@users.noreply.github.com> Date: Thu, 22 Aug 2024 20:23:04 +0100 Subject: [PATCH] feat: enhance dropdown component with link navigation options and transitions (#523) --- .../components/calendar/calendar.ex | 4 +- lib/atomic_web/components/dropdown.ex | 47 +++++++++++++++---- .../live/department_live/show.html.heex | 4 +- .../templates/layout/_live_navbar.html.heex | 8 ++-- storybook/components/dropdown.story.exs | 30 ++++++------ 5 files changed, 60 insertions(+), 33 deletions(-) diff --git a/lib/atomic_web/components/calendar/calendar.ex b/lib/atomic_web/components/calendar/calendar.ex index 7c27db643..689b0a056 100644 --- a/lib/atomic_web/components/calendar/calendar.ex +++ b/lib/atomic_web/components/calendar/calendar.ex @@ -90,8 +90,8 @@ defmodule AtomicWeb.Components.Calendar do id="calendar-dropdown" orientation={:down} items={[ - %{name: gettext("Week view"), link: @current_week_path}, - %{name: gettext("Month view"), link: @current_month_path} + %{name: gettext("Week view"), patch: @current_week_path}, + %{name: gettext("Month view"), patch: @current_month_path} ]} > <:wrapper> diff --git a/lib/atomic_web/components/dropdown.ex b/lib/atomic_web/components/dropdown.ex index eb81121d3..01c52222c 100644 --- a/lib/atomic_web/components/dropdown.ex +++ b/lib/atomic_web/components/dropdown.ex @@ -1,5 +1,7 @@ defmodule AtomicWeb.Components.Dropdown do - @moduledoc false + @moduledoc """ + A customizable dropdown component for displaying a list of items, with flexible styling and behavior options. + """ use Phoenix.Component import AtomicWeb.Components.Icon @@ -25,17 +27,42 @@ defmodule AtomicWeb.Components.Dropdown do def dropdown(assigns) do ~H""" -