refactor
This commit is contained in:
parent
4fb5b12ea7
commit
baa288bff3
11 changed files with 401 additions and 780 deletions
|
|
@ -171,11 +171,21 @@ defmodule MvWeb.CoreComponents do
|
|||
attr :phx_target, :any, required: true, doc: "The LiveView/LiveComponent target for events"
|
||||
attr :menu_class, :string, default: nil, doc: "Additional CSS classes for the menu"
|
||||
attr :menu_width, :string, default: "w-64", doc: "Width class for the menu (default: w-64)"
|
||||
attr :button_class, :string, default: nil, doc: "Additional CSS classes for the button (e.g., btn-secondary)"
|
||||
attr :menu_align, :string, default: "right", doc: "Menu alignment: 'left' or 'right' (default: right)"
|
||||
|
||||
attr :button_class, :string,
|
||||
default: nil,
|
||||
doc: "Additional CSS classes for the button (e.g., btn-secondary)"
|
||||
|
||||
attr :menu_align, :string,
|
||||
default: "right",
|
||||
doc: "Menu alignment: 'left' or 'right' (default: right)"
|
||||
|
||||
attr :testid, :string, default: "dropdown-menu", doc: "data-testid for the dropdown container"
|
||||
attr :button_testid, :string, default: "dropdown-button", doc: "data-testid for the button"
|
||||
attr :menu_testid, :string, default: nil, doc: "data-testid for the menu (defaults to testid + '-menu')"
|
||||
|
||||
attr :menu_testid, :string,
|
||||
default: nil,
|
||||
doc: "data-testid for the menu (defaults to testid + '-menu')"
|
||||
|
||||
slot :inner_block, doc: "Custom content for the dropdown menu (e.g., forms)"
|
||||
|
||||
|
|
@ -200,7 +210,14 @@ defmodule MvWeb.CoreComponents do
|
|||
aria-expanded={@open}
|
||||
aria-controls={@id}
|
||||
aria-label={@button_label}
|
||||
class={["btn", "focus:outline-none", "focus-visible:ring-2", "focus-visible:ring-offset-2", "focus-visible:ring-base-content/20", @button_class]}
|
||||
class={[
|
||||
"btn",
|
||||
"focus:outline-none",
|
||||
"focus-visible:ring-2",
|
||||
"focus-visible:ring-offset-2",
|
||||
"focus-visible:ring-base-content/20",
|
||||
@button_class
|
||||
]}
|
||||
phx-click="toggle_dropdown"
|
||||
phx-target={@phx_target}
|
||||
data-testid={@button_testid}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ defmodule MvWeb.Components.ExportDropdown do
|
|||
button_label =
|
||||
gettext("Export") <>
|
||||
" (" <>
|
||||
(if assigns.selected_count == 0, do: gettext("all"), else: to_string(assigns.selected_count)) <>
|
||||
if(assigns.selected_count == 0,
|
||||
do: gettext("all"),
|
||||
else: to_string(assigns.selected_count)
|
||||
) <>
|
||||
")"
|
||||
|
||||
assigns = assign(assigns, :button_label, button_label)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue