Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

Commit d92286b

Browse files
committed
CoreComponents: Add & update
1 parent 1a8e320 commit d92286b

File tree

7 files changed

+712
-28
lines changed

7 files changed

+712
-28
lines changed

lib/daisy_ui.ex renamed to lib/daisy.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
defmodule DaisyUi do
1+
defmodule Daisy do
22
@moduledoc ~S"""
33
<p>
4-
An implementation of <a href="https://daisyui.com" target="blank">DaisyUI</a> for Phoenix LiveView.
4+
An implementation of <a href="https://daisyui.com" target="blank">DaisyUI</a> `5` for Phoenix LiveView.
55
</p>
66
77
<p>

lib/component.ex renamed to lib/daisy/component.ex

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule DaisyUi.Component do
1111
## Examples
1212
1313
<.alert>
14-
<p>This is an alert!</p>
14+
This is an alert!
1515
</.alert>
1616
1717
## Reference
@@ -24,8 +24,8 @@ defmodule DaisyUi.Component do
2424
doc: "The kind of alert to show"
2525

2626
slot :inner_block, required: true, doc: "Alert Text/Content"
27-
slot :prefix, optional: true, doc: "Rendered before the main text, usually an icon"
28-
slot :suffix, optional: true, doc: "Rendered after the main text, usually used for buttons"
27+
slot :prefix, doc: "Rendered before the main text, usually an icon"
28+
slot :suffix, doc: "Rendered after the main text, usually used for buttons"
2929

3030
def alert(assigns) do
3131
~H"""
@@ -36,13 +36,33 @@ defmodule DaisyUi.Component do
3636
@kind && "alert-#{@kind}"
3737
]}
3838
>
39-
<%= render_slot(@prefix) %>
40-
<div><%= render_slot(@inner_block) %></div>
41-
<%= render_slot(@prefix) %>
39+
{render_slot(@prefix)}
40+
<div>{render_slot(@inner_block)}</div>
41+
{render_slot(@prefix)}
4242
</div>
4343
"""
4444
end
4545

46+
@doc section: :action
47+
@doc ~S"""
48+
A button component.
49+
50+
## Examples
51+
52+
<.button>Click Me</.button>
53+
54+
## Reference
55+
56+
[DaisyUI Button](https://daisyui.com/components/button/)
57+
"""
58+
slot :inner_block, required: true, doc: "Button Text/Content"
59+
60+
def button(assigns) do
61+
~H"""
62+
<button class="btn btn-primary">{render_slot(@inner_block)}</button>
63+
"""
64+
end
65+
4666
@doc section: :data_input
4767
@doc ~S"""
4868
A label component.
@@ -62,7 +82,7 @@ defmodule DaisyUi.Component do
6282
def label(assigns) do
6383
~H"""
6484
<div class="label">
65-
<span class="label-text"><%= render_slot(@inner_block) %></span>
85+
<span class="label-text">{render_slot(@inner_block)}</span>
6686
</div>
6787
"""
6888
end

0 commit comments

Comments
 (0)