ui_components 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ui_components/controllers/countdown_controller.js +55 -0
  3. data/app/components/documentation/body/example_preview_component.rb +1 -1
  4. data/app/components/documentation/body_component.html.erb +1 -1
  5. data/app/components/documentation/body_component.rb +4 -4
  6. data/app/components/ui_components/daisy_ui/action/button_component.rb +13 -13
  7. data/app/components/ui_components/daisy_ui/action/dropdown/anchor_component.rb +1 -11
  8. data/app/components/ui_components/daisy_ui/action/dropdown/card/item_component.rb +20 -0
  9. data/app/components/ui_components/daisy_ui/action/dropdown/card_component.rb +4 -14
  10. data/app/components/ui_components/daisy_ui/action/dropdown/menu/item_component.rb +32 -0
  11. data/app/components/ui_components/daisy_ui/action/dropdown/menu_component.rb +2 -12
  12. data/app/components/ui_components/daisy_ui/action/dropdown_component.rb +12 -12
  13. data/app/components/ui_components/daisy_ui/action/modal/anchor_component.rb +1 -11
  14. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/action/item_component.rb +0 -9
  15. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/action_component.rb +0 -9
  16. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/body_component.rb +0 -9
  17. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/close_component.rb +0 -9
  18. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/title_component.rb +0 -9
  19. data/app/components/ui_components/daisy_ui/action/modal/dialog/box_component.rb +0 -9
  20. data/app/components/ui_components/daisy_ui/action/modal/dialog_component.rb +2 -12
  21. data/app/components/ui_components/daisy_ui/action/swap/off_component.rb +0 -9
  22. data/app/components/ui_components/daisy_ui/action/swap/on_component.rb +0 -9
  23. data/app/components/ui_components/daisy_ui/action/swap_component.rb +6 -6
  24. data/app/components/ui_components/daisy_ui/base_component.rb +24 -3
  25. data/app/components/ui_components/daisy_ui/data_display/accordion/item/anchor_component.rb +20 -0
  26. data/app/components/ui_components/daisy_ui/data_display/accordion/item/body_component.rb +20 -0
  27. data/app/components/ui_components/daisy_ui/data_display/accordion/item_component.rb +15 -15
  28. data/app/components/ui_components/daisy_ui/data_display/avatar/item/box_component.rb +63 -0
  29. data/app/components/ui_components/daisy_ui/data_display/avatar/item_component.rb +8 -8
  30. data/app/components/ui_components/daisy_ui/data_display/badge_component.rb +7 -7
  31. data/app/components/ui_components/daisy_ui/data_display/card/body/action_component.rb +20 -0
  32. data/app/components/ui_components/daisy_ui/data_display/card/body/context_component.rb +17 -0
  33. data/app/components/ui_components/daisy_ui/data_display/card/body/title_component.rb +20 -0
  34. data/app/components/ui_components/daisy_ui/data_display/card/body_component.rb +34 -0
  35. data/app/components/ui_components/daisy_ui/data_display/card/figure_component.rb +15 -0
  36. data/app/components/ui_components/daisy_ui/data_display/card_component.rb +83 -0
  37. data/app/components/ui_components/daisy_ui/data_display/carousel/indicator_component.rb +18 -0
  38. data/app/components/ui_components/daisy_ui/data_display/carousel/item/passer_component.rb +20 -0
  39. data/app/components/ui_components/daisy_ui/data_display/carousel/item_component.rb +26 -0
  40. data/app/components/ui_components/daisy_ui/data_display/carousel_component.rb +63 -0
  41. data/app/components/ui_components/daisy_ui/data_display/chat/bubble_component.rb +42 -0
  42. data/app/components/ui_components/daisy_ui/data_display/chat/footer_component.rb +18 -0
  43. data/app/components/ui_components/daisy_ui/data_display/chat/header_component.rb +18 -0
  44. data/app/components/ui_components/daisy_ui/data_display/chat_component.rb +58 -0
  45. data/app/components/ui_components/daisy_ui/data_display/countdown/item_component.rb +49 -0
  46. data/app/components/ui_components/daisy_ui/data_display/countdown_component.rb +37 -0
  47. data/app/components/ui_components/daisy_ui/data_display/{accordion/anchor_component.rb → diff/item1_component.rb} +5 -8
  48. data/app/components/ui_components/daisy_ui/data_display/{accordion/body_component.rb → diff/item2_component.rb} +6 -8
  49. data/app/components/ui_components/daisy_ui/data_display/diff/resizer_component.rb +25 -0
  50. data/app/components/ui_components/daisy_ui/data_display/diff_component.rb +35 -0
  51. data/app/components/ui_components/daisy_ui/data_display/kbd_component.rb +40 -0
  52. data/app/components/ui_components/daisy_ui/data_display/list/item_component.rb +40 -0
  53. data/app/components/ui_components/daisy_ui/data_display/list_component.rb +22 -0
  54. data/app/components/ui_components/daisy_ui/data_display/stat/item/action_component.rb +20 -0
  55. data/app/components/ui_components/daisy_ui/data_display/stat/item/description_component.rb +20 -0
  56. data/app/components/ui_components/daisy_ui/data_display/stat/item/figure_component.rb +24 -0
  57. data/app/components/ui_components/daisy_ui/data_display/stat/item/title_component.rb +20 -0
  58. data/app/components/ui_components/daisy_ui/data_display/stat/item/value_component.rb +20 -0
  59. data/app/components/ui_components/daisy_ui/data_display/stat/item_component.rb +39 -0
  60. data/app/components/ui_components/daisy_ui/data_display/stat_component.rb +50 -0
  61. data/app/components/ui_components/daisy_ui/data_display/status_component.rb +59 -0
  62. data/app/components/ui_components/daisy_ui/data_display/table/item/body_component.rb +23 -0
  63. data/app/components/ui_components/daisy_ui/data_display/table/item/foot_component.rb +23 -0
  64. data/app/components/ui_components/daisy_ui/data_display/table/item/head_component.rb +23 -0
  65. data/app/components/ui_components/daisy_ui/data_display/table/item/row/data_component.rb +19 -0
  66. data/app/components/ui_components/daisy_ui/data_display/table/item/row/header_component.rb +19 -0
  67. data/app/components/ui_components/daisy_ui/data_display/table/item/row_component.rb +32 -0
  68. data/app/components/ui_components/daisy_ui/data_display/table/item_component.rb +29 -0
  69. data/app/components/ui_components/daisy_ui/data_display/table_component.rb +72 -0
  70. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_end_component.rb +44 -0
  71. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_middle_component.rb +20 -0
  72. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_start_component.rb +44 -0
  73. data/app/components/ui_components/daisy_ui/data_display/timeline/item/line_component.rb +17 -0
  74. data/app/components/ui_components/daisy_ui/data_display/timeline/item_component.rb +40 -0
  75. data/app/components/ui_components/daisy_ui/data_display/timeline_component.rb +50 -0
  76. data/app/controllers/ui_components/daisy_ui/data_display_components_controller.rb +22 -0
  77. data/app/helpers/data_display/carousel_helper.rb +13 -0
  78. data/app/views/ui_components/daisy_ui/action_components/button.html.erb +35 -33
  79. data/app/views/ui_components/daisy_ui/action_components/dropdown.html.erb +38 -25
  80. data/app/views/ui_components/daisy_ui/action_components/modal.html.erb +31 -18
  81. data/app/views/ui_components/daisy_ui/action_components/swap.html.erb +31 -17
  82. data/app/views/ui_components/daisy_ui/data_display_components/accordion.html.erb +59 -105
  83. data/app/views/ui_components/daisy_ui/data_display_components/avatar.html.erb +40 -27
  84. data/app/views/ui_components/daisy_ui/data_display_components/badge.html.erb +45 -42
  85. data/app/views/ui_components/daisy_ui/data_display_components/card.html.erb +302 -0
  86. data/app/views/ui_components/daisy_ui/data_display_components/carousel.html.erb +303 -0
  87. data/app/views/ui_components/daisy_ui/data_display_components/chat.html.erb +190 -0
  88. data/app/views/ui_components/daisy_ui/data_display_components/countdown.html.erb +211 -0
  89. data/app/views/ui_components/daisy_ui/data_display_components/diff.html.erb +69 -0
  90. data/app/views/ui_components/daisy_ui/data_display_components/kbd.html.erb +157 -0
  91. data/app/views/ui_components/daisy_ui/data_display_components/list.html.erb +247 -0
  92. data/app/views/ui_components/daisy_ui/data_display_components/stat.html.erb +208 -0
  93. data/app/views/ui_components/daisy_ui/data_display_components/status.html.erb +93 -0
  94. data/app/views/ui_components/daisy_ui/data_display_components/table.html.erb +358 -0
  95. data/app/views/ui_components/daisy_ui/data_display_components/timeline.html.erb +431 -0
  96. data/app/views/ui_components/daisy_ui/home/index.html.erb +11 -0
  97. data/config/routes.rb +13 -2
  98. data/lib/tasks/ui_components_tasks.rake +0 -3
  99. data/lib/ui_components/config/daisy_ui_class_names.rb +3 -2
  100. data/lib/ui_components/config/tailwind_class_names.rb +27 -4
  101. data/lib/ui_components/version.rb +1 -1
  102. metadata +65 -7
  103. data/app/components/ui_components/daisy_ui/action/dropdown/card_item_component.rb +0 -29
  104. data/app/components/ui_components/daisy_ui/action/dropdown/list_item_component.rb +0 -30
  105. data/app/components/ui_components/daisy_ui/data_display/avatar/box_component.rb +0 -61
@@ -6,17 +6,18 @@
6
6
  <ul class="bg-base-100 rounded-box shadow-md p-2">
7
7
  <%= link_to "< Avatar", daisy_ui_avatar_path, class: "link link-primary m-2" %>
8
8
  <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
9
+ <%= link_to "Card >", daisy_ui_card_path, class: "link link-primary m-2" %>
9
10
  </ul>
10
11
  </div>
11
12
 
12
- <%= render DocumentationComponent.new do |document| %>
13
- <%= document.with_header { "# Badge" } %>
14
- <%= document.with_body do |body| %>
13
+ <div class="divider"></div>
14
+
15
+ <%= render DocumentationComponent.new do |doc| %>
16
+ <%= doc.with_header { "# Badge" } %>
17
+ <%= doc.with_body do |body| %>
15
18
  <%= body.with_preview_example(
16
19
  source: <<~ERB
17
- <$= render #{component}.new do $>
18
- Default
19
- <$ end $>
20
+ <$= render #{component}.new.with_content("Default") $>
20
21
  ERB
21
22
  ) %>
22
23
  <% end %>
@@ -24,15 +25,13 @@
24
25
 
25
26
  <% sizes = { 'xs' => 'Xsmall', 'sm' => 'Small', 'md' => 'Medium', 'lg' => 'Large', 'xl' => 'Xlarge' } %>
26
27
 
27
- <%= render DocumentationComponent.new do |document| %>
28
- <%= document.with_header { "# Badge sizes" } %>
29
- <%= document.with_body do |body| %>
28
+ <%= render DocumentationComponent.new do |doc| %>
29
+ <%= doc.with_header { "# Badge sizes" } %>
30
+ <%= doc.with_body do |body| %>
30
31
  <% sizes.each do |key, value| %>
31
32
  <%= body.with_preview_example(
32
33
  source: <<~ERB
33
- <$= render #{component}.new(size: "#{key}") do $>
34
- #{value}
35
- <$ end $>
34
+ <$= render #{component}.new(size: "#{key}").with_content("#{value}") $>
36
35
  ERB
37
36
  ) %>
38
37
  <% end %>
@@ -41,15 +40,13 @@
41
40
 
42
41
  <% colors = { 'primary' => 'Primary', 'secondary' => 'Secondary', 'accent' => 'Accent', 'info' => 'Info', 'success' => 'Success', 'warning' => 'Warning', 'error' => 'Error' } %>
43
42
 
44
- <%= render DocumentationComponent.new do |document| %>
45
- <%= document.with_header { "# Badge with colors" } %>
46
- <%= document.with_body do |body| %>
43
+ <%= render DocumentationComponent.new do |doc| %>
44
+ <%= doc.with_header { "# Badge with colors" } %>
45
+ <%= doc.with_body do |body| %>
47
46
  <% colors.each do |key, value| %>
48
47
  <%= body.with_preview_example(
49
48
  source: <<~ERB
50
- <$= render #{component}.new(color: "#{key}") do $>
51
- #{value}
52
- <$ end $>
49
+ <$= render #{component}.new(color: "#{key}").with_content("#{value}") $>
53
50
  ERB
54
51
  ) %>
55
52
  <% end %>
@@ -59,18 +56,17 @@
59
56
  <% kinds = { 'soft' => 'Soft', 'outline' => 'Outline', 'dash' => 'Dash', 'ghost' => 'Ghost' } %>
60
57
 
61
58
  <% kinds.each do |kind_key, kind_value| %>
62
- <%= render DocumentationComponent.new do |document| %>
63
- <%= document.with_header { "# #{kind_value} #{kind_key == "ghost" ? 'badge' : 'badges'}" } %>
64
- <%= document.with_body do |body| %>
59
+ <%= render DocumentationComponent.new do |doc| %>
60
+ <%= doc.with_header { "# #{kind_value} #{kind_key == "ghost" ? 'badge' : 'badges'}" } %>
61
+ <%= doc.with_body do |body| %>
65
62
  <% colors.each do |color_key, value| %>
66
63
 
67
64
  <% next if data_display_badge_skip_kind(kind_key:, color_key:) %>
65
+ <% string_value = kind_key == 'ghost' ? kind_value : value %>
68
66
 
69
67
  <%= body.with_preview_example(
70
68
  source: <<~ERB
71
- <$= render #{component}.new(#{data_display_badge_handle_component_params(kind_key:, color_key:)}) do $>
72
- #{kind_key == "ghost" ? kind_value : value}
73
- <$ end $>
69
+ <$= render #{component}.new(#{data_display_badge_handle_component_params(kind_key:, color_key:)}).with_content("#{string_value}") $>
74
70
  ERB
75
71
  ) %>
76
72
  <% end %>
@@ -78,9 +74,9 @@
78
74
  <% end %>
79
75
  <% end %>
80
76
 
81
- <%= render DocumentationComponent.new do |document| %>
82
- <%= document.with_header { "# Empty badge" } %>
83
- <%= document.with_body do |body| %>
77
+ <%= render DocumentationComponent.new do |doc| %>
78
+ <%= doc.with_header { "# Empty badge" } %>
79
+ <%= doc.with_body do |body| %>
84
80
  <% sizes.keys.reverse.each do |key| %>
85
81
  <%= body.with_preview_example(
86
82
  source: <<~ERB
@@ -93,9 +89,9 @@
93
89
 
94
90
  <% badge_with_icon_colors = { 'info' => 'Info', 'success' => 'Success', 'warning' => 'Warning', 'error' => 'Error' } %>
95
91
 
96
- <%= render DocumentationComponent.new do |document| %>
97
- <%= document.with_header { "# Badge with icon" } %>
98
- <%= document.with_body do |body| %>
92
+ <%= render DocumentationComponent.new do |doc| %>
93
+ <%= doc.with_header { "# Badge with icon" } %>
94
+ <%= doc.with_body do |body| %>
99
95
  <% badge_with_icon_colors.each do |key, value| %>
100
96
  <%= body.with_preview_example(
101
97
  source: <<~ERB
@@ -110,17 +106,15 @@
110
106
  <% end %>
111
107
 
112
108
 
113
- <%= render DocumentationComponent.new do |document| %>
114
- <%= document.with_header { "# Badge in a text" } %>
115
- <%= document.with_body do |body| %>
109
+ <%= render DocumentationComponent.new do |doc| %>
110
+ <%= doc.with_header { "# Badge in a text" } %>
111
+ <%= doc.with_body do |body| %>
116
112
  <% sizes.keys.reverse.each_with_index do |key, index| %>
117
113
  <%= body.with_preview_example(
118
114
  source: <<~ERB
119
115
  <h1 class="text-#{key == "md" ? "base" : key} font-semibold">
120
116
  Heading #{index+1}
121
- <$= render #{component}.new(size: "#{key}") do $>
122
- Badge
123
- <$ end $>
117
+ <$= render #{component}.new(size: "#{key}").with_content("Badge") $>
124
118
  </h1>
125
119
  ERB
126
120
  ) %>
@@ -130,21 +124,30 @@
130
124
 
131
125
  <% badge_with_button_colors = ["", "secondary"] %>
132
126
 
133
- <%= render DocumentationComponent.new do |document| %>
134
- <%= document.with_header { "# Badge in a button" } %>
135
- <%= document.with_body do |body| %>
127
+ <%= render DocumentationComponent.new do |doc| %>
128
+ <%= doc.with_header { "# Badge in a button" } %>
129
+ <%= doc.with_body do |body| %>
136
130
  <% badge_with_button_colors.each do |key| %>
137
131
  <%= body.with_preview_example(
138
132
  source: <<~ERB
139
133
  <$= render UiComponents::DaisyUi::Action::ButtonComponent.new do $>
140
134
  Inbox
141
- <$= render #{component}.new(size: "sm"#{", color: \"#{key}\"" if key.present?}) do $>
142
- +99
143
- <$ end $>
135
+ <$= render #{component}.new(size: "sm"#{", color: \"#{key}\"" if key.present?}).with_content("+99") $>
144
136
  <$ end $>
145
137
  ERB
146
138
  ) %>
147
139
  <% end %>
148
140
  <% end %>
149
141
  <% end %>
142
+
143
+ <div class="divider"></div>
144
+
145
+ <div class="mb-2">
146
+ <h1 class="font-bold mb-2"># Data display > Badge</h1>
147
+ <ul class="bg-base-100 rounded-box shadow-md p-2">
148
+ <%= link_to "< Avatar", daisy_ui_avatar_path, class: "link link-primary m-2" %>
149
+ <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
150
+ <%= link_to "Card >", daisy_ui_card_path, class: "link link-primary m-2" %>
151
+ </ul>
152
+ </div>
150
153
  </div>
@@ -0,0 +1,302 @@
1
+ <% component = UiComponents::DaisyUi::DataDisplay::CardComponent %>
2
+
3
+ <div class="grid grid-cols gap-16 p-2 mt-6 mb-36">
4
+ <div class="mb-2">
5
+ <h1 class="font-bold mb-2"># Data display > Card</h1>
6
+ <ul class="bg-base-100 rounded-box shadow-md p-2">
7
+ <%= link_to "< Badge", daisy_ui_badge_path, class: "link link-primary m-2" %>
8
+ <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
9
+ <%= link_to "Carousel >", daisy_ui_carousel_path, class: "link link-primary m-2" %>
10
+ </ul>
11
+ </div>
12
+
13
+ <div class="divider"></div>
14
+
15
+ <%= render DocumentationComponent.new do |doc| %>
16
+ <%= doc.with_header { "# Card" } %>
17
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
18
+ <%= body.with_preview_example(
19
+ source: <<~ERB
20
+ <$= render #{component}.new do |card| $>
21
+ <$= card.with_figure do $>
22
+ <img src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp" alt="Shoes" />
23
+ <$ end $>
24
+
25
+ <$= card.with_body do |body| $>
26
+ <$= body.with_title_content("Card Title") $>
27
+ <$= body.with_context do $>
28
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
29
+ <$ end $>
30
+
31
+ <$= body.with_action do $>
32
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Buy Now") $>
33
+ <$ end $>
34
+ <$ end $>
35
+ <$ end $>
36
+ ERB
37
+ ) %>
38
+ <% end %>
39
+ <% end %>
40
+
41
+ <% sizes = { 'xs' => 'Xsmall', 'sm' => 'Small', 'md' => 'Medium', 'lg' => 'Large', 'xl' => 'Xlarge' } %>
42
+
43
+ <%= render DocumentationComponent.new do |doc| %>
44
+ <%= doc.with_header { "# Card sizes" } %>
45
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
46
+ <% sizes.each do |key, value| %>
47
+ <%= body.with_preview_example(
48
+
49
+ source: <<~ERB
50
+ <$= render #{component}.new(size: "#{key}") do |card| $>
51
+ <$= card.with_body do |body| $>
52
+ <$= body.with_title_content("#{value} Card") $>
53
+ <$= body.with_context do $>
54
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
55
+ <$ end $>
56
+
57
+ <$= body.with_action do $>
58
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Buy Now") $>
59
+ <$ end $>
60
+ <$ end $>
61
+ <$ end $>
62
+ ERB
63
+ ) %>
64
+ <% end %>
65
+ <% end %>
66
+ <% end %>
67
+
68
+ <% border_kinds = { 'border' => 'card-border', 'dash' => 'dash border' } %>
69
+
70
+ <% border_kinds.each do |key, value| %>
71
+ <%= render DocumentationComponent.new do |doc| %>
72
+ <%= doc.with_header { "# Card with a #{value}" } %>
73
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-100" }) do |body| %>
74
+ <%= body.with_preview_example(
75
+ source: <<~ERB
76
+ <$= render #{component}.new(border_kind: "#{key}") do |card| $>
77
+ <$= card.with_body do |body| $>
78
+ <$= body.with_title_content("Card Title") $>
79
+ <$= body.with_context do $>
80
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
81
+ <$ end $>
82
+
83
+ <$= body.with_action do $>
84
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Buy Now") $>
85
+ <$ end $>
86
+ <$ end $>
87
+ <$ end $>
88
+ ERB
89
+ ) %>
90
+ <% end %>
91
+ <% end %>
92
+ <% end %>
93
+
94
+ <%= render DocumentationComponent.new do |doc| %>
95
+ <%= doc.with_header { "# Card with badge" } %>
96
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
97
+ <%= body.with_preview_example(
98
+ source: <<~ERB
99
+ <$= render #{component}.new do |card| $>
100
+ <$= card.with_figure do $>
101
+ <img src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp" alt="Shoes" />
102
+ <$ end $>
103
+
104
+ <$= card.with_body do |body| $>
105
+ <$= body.with_title do $>
106
+ Card Title
107
+ <$= render UiComponents::DaisyUi::DataDisplay::BadgeComponent.new(color: "secondary").with_content("NEW") $>
108
+ <$ end $>
109
+
110
+ <$= body.with_context do $>
111
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
112
+ <$ end $>
113
+
114
+ <$= body.with_action do $>
115
+ <$= render UiComponents::DaisyUi::DataDisplay::BadgeComponent.new(kind: "outline").with_content("Fashion") $>
116
+ <$= render UiComponents::DaisyUi::DataDisplay::BadgeComponent.new(kind: "outline").with_content("Products") $>
117
+ <$ end $>
118
+ <$ end $>
119
+ <$ end $>
120
+ ERB
121
+ ) %>
122
+ <% end %>
123
+ <% end %>
124
+
125
+ <%= render DocumentationComponent.new do |doc| %>
126
+ <%= doc.with_header { "# Card with bottom image" } %>
127
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
128
+ <%= body.with_preview_example(
129
+ source: <<~ERB
130
+ <$= render #{component}.new do |card| $>
131
+ <$= card.with_body do |body| $>
132
+ <$= body.with_title_content("Card Title") $>
133
+ <$= body.with_context do $>
134
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
135
+ <$ end $>
136
+ <$ end $>
137
+
138
+ <$= card.with_figure do $>
139
+ <img src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp" alt="Shoes" />
140
+ <$ end $>
141
+ <$ end $>
142
+ ERB
143
+ ) %>
144
+ <% end %>
145
+ <% end %>
146
+
147
+ <%= render DocumentationComponent.new do |doc| %>
148
+ <%= doc.with_header { "# Card with centered content and paddings" } %>
149
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
150
+ <%= body.with_preview_example(
151
+ source: <<~ERB
152
+ <$= render #{component}.new do |card| $>
153
+ <$= card.with_figure(css_class: "px-10 pt-10") do $>
154
+ <img class="rounded-xl" src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp" alt="Shoes" />
155
+ <$ end $>
156
+
157
+ <$= card.with_body(css_class: "items-center text-center") do |body| $>
158
+ <$= body.with_title_content("Card Title") $>
159
+ <$= body.with_context do $>
160
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
161
+ <$ end $>
162
+
163
+ <$= body.with_action do $>
164
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Buy Now") $>
165
+ <$ end $>
166
+ <$ end $>
167
+ <$ end $>
168
+ ERB
169
+ ) %>
170
+ <% end %>
171
+ <% end %>
172
+
173
+ <%= render DocumentationComponent.new do |doc| %>
174
+ <%= doc.with_header { "# Card with image overlay" } %>
175
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
176
+ <%= body.with_preview_example(
177
+ source: <<~ERB
178
+ <$= render #{component}.new(image_full: true) do |card| $>
179
+ <$= card.with_figure do $>
180
+ <img src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp" alt="Shoes" />
181
+ <$ end $>
182
+
183
+ <$= card.with_body do |body| $>
184
+ <$= body.with_title_content("Card Title") $>
185
+ <$= body.with_context do $>
186
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
187
+ <$ end $>
188
+ <$= body.with_action do $>
189
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Buy Now") $>
190
+ <$ end $>
191
+ <$ end $>
192
+ <$ end $>
193
+ ERB
194
+ ) %>
195
+ <% end %>
196
+ <% end %>
197
+
198
+ <%= render DocumentationComponent.new do |doc| %>
199
+ <%= doc.with_header { "# Card with custom color" } %>
200
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2" }) do |body| %>
201
+ <%= body.with_preview_example(
202
+ source: <<~ERB
203
+ <$= render #{component}.new(css_class: "bg-primary") do |card| $>
204
+ <$= card.with_body do |body| $>
205
+ <$= body.with_title_content("Card Title") $>
206
+ <$= body.with_context do $>
207
+ <p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
208
+ <$ end $>
209
+
210
+ <$= body.with_action do $>
211
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new.with_content("Buy Now") $>
212
+ <$ end $>
213
+ <$ end $>
214
+ <$ end $>
215
+ ERB
216
+ ) %>
217
+ <% end %>
218
+ <% end %>
219
+
220
+ <%= render DocumentationComponent.new do |doc| %>
221
+ <%= doc.with_header { "# Centered card with neutral color" } %>
222
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2" }) do |body| %>
223
+ <%= body.with_preview_example(
224
+ source: <<~ERB
225
+ <$= render #{component}.new(css_class: "bg-neutral") do |card| $>
226
+ <$= card.with_body(css_class: "items-center text-center") do |body| $>
227
+ <$= body.with_title_content("Cookies!") $>
228
+ <$= body.with_context do $>
229
+ <p>We are using cookies for no reason.</p>
230
+ <$ end $>
231
+
232
+ <$= body.with_action do $>
233
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Accept") $>
234
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "ghost").with_content("Deny") $>
235
+ <$ end $>
236
+ <$ end $>
237
+ <$ end $>
238
+ ERB
239
+ ) %>
240
+ <% end %>
241
+ <% end %>
242
+
243
+ <%= render DocumentationComponent.new do |doc| %>
244
+ <%= doc.with_header { "# Card with action on top" } %>
245
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
246
+ <%= body.with_preview_example(
247
+ source: <<~ERB
248
+ <$= render #{component}.new do |card| $>
249
+ <$= card.with_body do |body| $>
250
+ <$= body.with_action do $>
251
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(shape: "square", size: "sm") do $>
252
+ <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>
253
+ <$ end $>
254
+ <$ end $>
255
+
256
+ <$= body.with_context do $>
257
+ <p>We are using cookies for no reason.</p>
258
+ <$ end $>
259
+ <$ end $>
260
+ <$ end $>
261
+ ERB
262
+ ) %>
263
+ <% end %>
264
+ <% end %>
265
+
266
+ <%= render DocumentationComponent.new do |doc| %>
267
+ <%= doc.with_header { "# Card with image on side" } %>
268
+ <%= doc.with_body(preview_options: { css_class: "grid grid-cols gap-y-4 p-2 bg-base-200" }) do |body| %>
269
+ <%= body.with_preview_example(
270
+ source: <<~ERB
271
+ <$= render #{component}.new(side: true, css_class: "w-lg") do |card| $>
272
+ <$= card.with_figure do $>
273
+ <img src="https://img.daisyui.com/images/stock/photo-1635805737707-575885ab0820.webp" alt="Movie" />
274
+ <$ end $>
275
+
276
+ <$= card.with_body do |body| $>
277
+ <$= body.with_title_content("New movie is released!") $>
278
+ <$= body.with_context do $>
279
+ <p>Click the button to watch on Jetflix app.</p>
280
+ <$ end $>
281
+
282
+ <$= body.with_action do $>
283
+ <$= render UiComponents::DaisyUi::Action::ButtonComponent.new(color: "primary").with_content("Watch") $>
284
+ <$ end $>
285
+ <$ end $>
286
+ <$ end $>
287
+ ERB
288
+ ) %>
289
+ <% end %>
290
+ <% end %>
291
+
292
+ <div class="divider"></div>
293
+
294
+ <div class="mb-2">
295
+ <h1 class="font-bold mb-2"># Data display > Card</h1>
296
+ <ul class="bg-base-100 rounded-box shadow-md p-2">
297
+ <%= link_to "< Badge", daisy_ui_badge_path, class: "link link-primary m-2" %>
298
+ <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
299
+ <%= link_to "Carousel >", daisy_ui_carousel_path, class: "link link-primary m-2" %>
300
+ </ul>
301
+ </div>
302
+ </div>