Current section

41 Versions

Jump to

Compare versions

5 files changed
+86 additions
-3 deletions
  @@ -216,7 +216,7 @@ List of available components.
216 216 | [Divider](https://daisyui.com/components/divider) | ❌ | ❌ |
217 217 | [Drawer](https://daisyui.com/components/drawer) | ✅ | ✅ |
218 218 | [Footer](https://daisyui.com/components/footer) | ❌ | ❌ |
219 - | [Hero](https://daisyui.com/components/hero) | ❌ | ❌ |
219 + | [Hero](https://daisyui.com/components/hero) | ✅ | ✅ |
220 220 | [Indicator](https://daisyui.com/components/indicator) | ✅ | ✅ |
221 221 | [Join](https://daisyui.com/components/join) | ✅ | ✅ |
222 222 | [Mask](https://daisyui.com/components/mask) | ❌ | ❌ |
  @@ -1,7 +1,7 @@
1 1 {<<"links">>,
2 2 [{<<"GitHub">>,<<"https://github.com/phcurado/daisy_ui_components">>}]}.
3 3 {<<"name">>,<<"daisy_ui_components">>}.
4 - {<<"version">>,<<"0.7.5">>}.
4 + {<<"version">>,<<"0.7.6">>}.
5 5 {<<"description">>,<<"DaisyUI component library for LiveView">>}.
6 6 {<<"elixir">>,<<"~> 1.14">>}.
7 7 {<<"app">>,<<"daisy_ui_components">>}.
  @@ -18,6 +18,7 @@
18 18 <<"lib/daisy_ui_components/loading.ex">>,
19 19 <<"lib/daisy_ui_components/card.ex">>,<<"lib/daisy_ui_components/swap.ex">>,
20 20 <<"lib/daisy_ui_components/modal.ex">>,
21 + <<"lib/daisy_ui_components/hero.ex">>,
21 22 <<"lib/daisy_ui_components/navbar.ex">>,
22 23 <<"lib/daisy_ui_components/badge.ex">>,
23 24 <<"lib/daisy_ui_components/table.ex">>,
  @@ -54,6 +54,7 @@ defmodule DaisyUIComponents do
54 54 import DaisyUIComponents.Dropdown
55 55 import DaisyUIComponents.Form
56 56 import DaisyUIComponents.Header
57 + import DaisyUIComponents.Hero
57 58 import DaisyUIComponents.Icon
58 59 import DaisyUIComponents.Indicator
59 60 import DaisyUIComponents.Input
  @@ -0,0 +1,80 @@
1 + defmodule DaisyUIComponents.Hero do
2 + @moduledoc """
3 + Hero component
4 +
5 + https://daisyui.com/components/hero/
6 + """
7 +
8 + use DaisyUIComponents, :component
9 +
10 + @doc """
11 + Renders a hero component.
12 +
13 + ## Examples
14 +
15 + <.hero>
16 + <:content>
17 + <h1 class="text-5xl font-bold">Hello there</h1>
18 + </:content>
19 + </.hero>
20 + """
21 + attr :class, :string, default: nil
22 + attr :rest, :global
23 +
24 + slot :content do
25 + attr :class, :any
26 + end
27 +
28 + slot :overlay do
29 + attr :class, :any
30 + end
31 +
32 + slot :inner_block
33 +
34 + def hero(assigns) do
35 + assigns =
36 + assign(assigns, :class, classes(["hero", assigns.class]))
37 +
38 + ~H"""
39 + <div class={@class} {@rest}>
40 + <.hero_overlay :for={overlay <- @overlay} class={overlay[:class]}>
41 + {render_slot(overlay)}
42 + </.hero_overlay>
43 + <.hero_content :for={content <- @content} class={content[:class]}>
44 + {render_slot(content)}
45 + </.hero_content>
46 + {render_slot(@inner_block)}
47 + </div>
48 + """
49 + end
50 +
51 + attr :class, :string, default: nil
52 + attr :rest, :global
53 + slot :inner_block
54 +
55 + def hero_content(assigns) do
56 + assigns =
57 + assign(assigns, :class, classes(["hero-content", assigns.class]))
58 +
59 + ~H"""
60 + <div class={@class} {@rest}>
61 + {render_slot(@inner_block)}
62 + </div>
63 + """
64 + end
65 +
66 + attr :class, :string, default: nil
67 + attr :rest, :global
68 + slot :inner_block
69 +
70 + def hero_overlay(assigns) do
71 + assigns =
72 + assign(assigns, :class, classes(["hero-overlay", assigns.class]))
73 +
74 + ~H"""
75 + <div class={@class} {@rest}>
76 + {render_slot(@inner_block)}
77 + </div>
78 + """
79 + end
80 + 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.7.5"
5 + @version "0.7.6"
6 6
7 7 def project do
8 8 [
  @@ -76,6 +76,7 @@ defmodule DaisyUIComponents.MixProject do
76 76 DaisyUIComponents.Dropdown,
77 77 DaisyUIComponents.Form,
78 78 DaisyUIComponents.Header,
79 + DaisyUIComponents.Hero,
79 80 DaisyUIComponents.Icon,
80 81 DaisyUIComponents.Indicator,
81 82 DaisyUIComponents.Input,