Current section
41 Versions
Jump to
Current section
41 Versions
Compare versions
4
files changed
+67
additions
-3
deletions
| @@ -21,7 +21,9 @@ | |
| 21 21 | <<"lib/daisy_ui_components/checkbox.ex">>, |
| 22 22 | <<"lib/daisy_ui_components/select.ex">>, |
| 23 23 | <<"lib/daisy_ui_components/alert.ex">>, |
| 24 | - <<"lib/daisy_ui_components/form.ex">>,<<"lib/daisy_ui_components/icon.ex">>, |
| 24 | + <<"lib/daisy_ui_components/form.ex">>, |
| 25 | + <<"lib/daisy_ui_components/breadcrumbs.ex">>, |
| 26 | + <<"lib/daisy_ui_components/icon.ex">>, |
| 25 27 | <<"lib/daisy_ui_components/text_input.ex">>, |
| 26 28 | <<"lib/daisy_ui_components/join.ex">>, |
| 27 29 | <<"lib/daisy_ui_components/input.ex">>, |
| @@ -40,4 +42,4 @@ | |
| 40 42 | {<<"optional">>,false}, |
| 41 43 | {<<"repository">>,<<"hexpm">>}, |
| 42 44 | {<<"requirement">>,<<"~> 0.20.14">>}]]}. |
| 43 | - {<<"version">>,<<"0.1.4">>}. |
| 45 | + {<<"version">>,<<"0.1.5">>}. |
| @@ -11,6 +11,7 @@ defmodule DaisyUIComponents do | |
| 11 11 | import DaisyUIComponents.Alert |
| 12 12 | import DaisyUIComponents.Avatar |
| 13 13 | import DaisyUIComponents.Badge |
| 14 | + import DaisyUIComponents.Breadcrumbs |
| 14 15 | import DaisyUIComponents.Button |
| 15 16 | import DaisyUIComponents.ButtonGroup |
| 16 17 | import DaisyUIComponents.Card |
| @@ -0,0 +1,61 @@ | |
| 1 | + defmodule DaisyUIComponents.Breadcrumbs do |
| 2 | + @moduledoc """ |
| 3 | + Stat component |
| 4 | + |
| 5 | + https://daisyui.com/components/stat |
| 6 | + |
| 7 | + """ |
| 8 | + |
| 9 | + use DaisyUIComponents.Component |
| 10 | + |
| 11 | + import DaisyUIComponents.Icon |
| 12 | + |
| 13 | + attr :class, :string, default: nil |
| 14 | + attr :rest, :global |
| 15 | + |
| 16 | + slot :item do |
| 17 | + attr :icon, :string |
| 18 | + attr :path, :string |
| 19 | + end |
| 20 | + |
| 21 | + slot :inner_block |
| 22 | + |
| 23 | + def breadcrumbs(assigns) do |
| 24 | + ~H""" |
| 25 | + <div class={["breadcrumbs", @class]} {@rest}> |
| 26 | + <ul :if={render?(@item)}> |
| 27 | + <%= for item <- @item do %> |
| 28 | + <li> |
| 29 | + <.render_link path={item[:path]}> |
| 30 | + <.render_icon icon={item[:icon]} /> |
| 31 | + <%= render_slot(item) %> |
| 32 | + </.render_link> |
| 33 | + </li> |
| 34 | + <% end %> |
| 35 | + </ul> |
| 36 | + |
| 37 | + <%= render_slot(@inner_block) %> |
| 38 | + </div> |
| 39 | + """ |
| 40 | + end |
| 41 | + |
| 42 | + defp render_link(%{path: nil} = assigns) do |
| 43 | + ~H""" |
| 44 | + <%= render_slot(@inner_block) %> |
| 45 | + """ |
| 46 | + end |
| 47 | + |
| 48 | + defp render_link(assigns) do |
| 49 | + ~H""" |
| 50 | + <.link :if={@path} navigate={@path}> |
| 51 | + <%= render_slot(@inner_block) %> |
| 52 | + </.link> |
| 53 | + """ |
| 54 | + end |
| 55 | + |
| 56 | + defp render_icon(assigns) do |
| 57 | + ~H""" |
| 58 | + <.icon :if={@icon} name={@icon} class="w-4 h-4 mr-2" /> |
| 59 | + """ |
| 60 | + end |
| 61 | + 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.4" |
| 5 | + @version "0.1.5" |
| 6 6 | |
| 7 7 | def project do |
| 8 8 | [ |