Current section
41 Versions
Jump to
Current section
41 Versions
Compare versions
3
files changed
+80
additions
-23
deletions
| @@ -3,31 +3,32 @@ | |
| 3 3 | {<<"description">>,<<"DaisyUI component library for LiveView">>}. |
| 4 4 | {<<"elixir">>,<<"~> 1.14">>}. |
| 5 5 | {<<"files">>, |
| 6 | - [<<"lib">>,<<"lib/daisy_ui_components.ex">>,<<"lib/daisy_ui_components">>, |
| 7 | - <<"lib/daisy_ui_components/navbar.ex">>, |
| 8 | - <<"lib/daisy_ui_components/join.ex">>, |
| 9 | - <<"lib/daisy_ui_components/avatar.ex">>, |
| 10 | - <<"lib/daisy_ui_components/badge.ex">>, |
| 11 | - <<"lib/daisy_ui_components/tooltip.ex">>, |
| 12 | - <<"lib/daisy_ui_components/icon.ex">>, |
| 13 | - <<"lib/daisy_ui_components/core_components.ex">>, |
| 14 | - <<"lib/daisy_ui_components/textarea.ex">>, |
| 15 | - <<"lib/daisy_ui_components/text_input.ex">>, |
| 16 | - <<"lib/daisy_ui_components/drawer.ex">>, |
| 17 | - <<"lib/daisy_ui_components/select.ex">>, |
| 18 | - <<"lib/daisy_ui_components/pagination.ex">>, |
| 19 | - <<"lib/daisy_ui_components/table.ex">>, |
| 20 | - <<"lib/daisy_ui_components/component.ex">>, |
| 21 | - <<"lib/daisy_ui_components/button_group.ex">>, |
| 22 | - <<"lib/daisy_ui_components/alert.ex">>, |
| 23 | - <<"lib/daisy_ui_components/checkbox.ex">>, |
| 24 | - <<"lib/daisy_ui_components/card.ex">>, |
| 6 | + [<<"lib">>,<<"lib/daisy_ui_components">>, |
| 25 7 | <<"lib/daisy_ui_components/utils.ex">>, |
| 8 | + <<"lib/daisy_ui_components/drawer.ex">>, |
| 9 | + <<"lib/daisy_ui_components/component.ex">>, |
| 10 | + <<"lib/daisy_ui_components/textarea.ex">>, |
| 11 | + <<"lib/daisy_ui_components/avatar.ex">>, |
| 12 | + <<"lib/daisy_ui_components/pagination.ex">>, |
| 13 | + <<"lib/daisy_ui_components/tooltip.ex">>, |
| 14 | + <<"lib/daisy_ui_components/card.ex">>, |
| 15 | + <<"lib/daisy_ui_components/modal.ex">>, |
| 16 | + <<"lib/daisy_ui_components/navbar.ex">>, |
| 17 | + <<"lib/daisy_ui_components/badge.ex">>, |
| 18 | + <<"lib/daisy_ui_components/table.ex">>, |
| 19 | + <<"lib/daisy_ui_components/dropdown.ex">>, |
| 26 20 | <<"lib/daisy_ui_components/button.ex">>, |
| 27 | - <<"lib/daisy_ui_components/form.ex">>, |
| 21 | + <<"lib/daisy_ui_components/checkbox.ex">>, |
| 22 | + <<"lib/daisy_ui_components/select.ex">>, |
| 23 | + <<"lib/daisy_ui_components/alert.ex">>, |
| 24 | + <<"lib/daisy_ui_components/form.ex">>,<<"lib/daisy_ui_components/icon.ex">>, |
| 25 | + <<"lib/daisy_ui_components/text_input.ex">>, |
| 26 | + <<"lib/daisy_ui_components/join.ex">>, |
| 28 27 | <<"lib/daisy_ui_components/input.ex">>, |
| 28 | + <<"lib/daisy_ui_components/core_components.ex">>, |
| 29 29 | <<"lib/daisy_ui_components/stat.ex">>, |
| 30 | - <<"lib/daisy_ui_components/modal.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 30 | + <<"lib/daisy_ui_components/button_group.ex">>, |
| 31 | + <<"lib/daisy_ui_components.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 31 32 | <<"README.md">>,<<"LICENSE">>]}. |
| 32 33 | {<<"licenses">>,[<<"Apache-2.0">>]}. |
| 33 34 | {<<"links">>, |
| @@ -39,4 +40,4 @@ | |
| 39 40 | {<<"optional">>,false}, |
| 40 41 | {<<"repository">>,<<"hexpm">>}, |
| 41 42 | {<<"requirement">>,<<"~> 0.20.14">>}]]}. |
| 42 | - {<<"version">>,<<"0.1.2">>}. |
| 43 | + {<<"version">>,<<"0.1.3">>}. |
| @@ -0,0 +1,56 @@ | |
| 1 | + defmodule DaisyUIComponents.Dropdown do |
| 2 | + @moduledoc """ |
| 3 | + Dropdown component |
| 4 | + |
| 5 | + https://daisyui.com/components/dropdown/ |
| 6 | + |
| 7 | + |
| 8 | + """ |
| 9 | + |
| 10 | + use DaisyUIComponents.Component |
| 11 | + |
| 12 | + @doc """ |
| 13 | + Renders a button group. |
| 14 | + |
| 15 | + ## Examples |
| 16 | + |
| 17 | + <.dropdown> |
| 18 | + <summary class="btn m-1">open or close</summary> |
| 19 | + <ul class="menu dropdown-content bg-base-100 rounded-box z-[1] w-52 p-2 shadow"> |
| 20 | + <li><a>Item 1</a></li> |
| 21 | + <li><a>Item 2</a></li> |
| 22 | + </ul> |
| 23 | + </.dropdown> |
| 24 | + """ |
| 25 | + attr :class, :string, default: nil |
| 26 | + attr :top, :boolean, default: nil |
| 27 | + attr :bottom, :boolean, default: nil |
| 28 | + attr :end, :boolean, default: nil |
| 29 | + attr :left, :boolean, default: nil |
| 30 | + attr :right, :boolean, default: nil |
| 31 | + attr :hover, :boolean, default: nil |
| 32 | + attr :open, :boolean, default: nil |
| 33 | + attr :rest, :global |
| 34 | + slot :inner_block, required: true |
| 35 | + |
| 36 | + def dropdown(assigns) do |
| 37 | + assigns = |
| 38 | + assign(assigns, :class, [ |
| 39 | + "dropdown", |
| 40 | + add_class_from_bool(assigns.top, "dropdown-top"), |
| 41 | + add_class_from_bool(assigns.bottom, "dropdown-bottom"), |
| 42 | + add_class_from_bool(assigns.end, "dropdown-end"), |
| 43 | + add_class_from_bool(assigns.left, "dropdown-left"), |
| 44 | + add_class_from_bool(assigns.right, "dropdown-right"), |
| 45 | + add_class_from_bool(assigns.hover, "dropdown-hover"), |
| 46 | + add_class_from_bool(assigns.open, "dropdown-open"), |
| 47 | + assigns.class |
| 48 | + ]) |
| 49 | + |
| 50 | + ~H""" |
| 51 | + <div class={@class} {@rest}> |
| 52 | + <%= render_slot(@inner_block) %> |
| 53 | + </div> |
| 54 | + """ |
| 55 | + end |
| 56 | + end |
| @@ -2,7 +2,7 @@ defmodule DaisyUIComponents.MixProject do | |
| 2 2 | use Mix.Project |
| 3 3 | |
| 4 4 | @source_url "https://github.com/phcurado/daisy_ui_components" |
| 5 | - @version "0.1.2" |
| 5 | + @version "0.1.3" |
| 6 6 | |
| 7 7 | def project do |
| 8 8 | [ |