Skip to content

Commit 0c0e451

Browse files
authored
Merge pull request #80 from substancelab/docs/input
Expose documentation
2 parents f38b615 + 12ce0d1 commit 0c0e451

File tree

12 files changed

+37
-23
lines changed

12 files changed

+37
-23
lines changed

app/components/flowbite/card.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ module Flowbite
77
#
88
# To render a title in the card, use the title argument or the title slot.
99
#
10-
# If you want to customize the title element completely, use the title slot.
11-
# You can even use +Flowbite::Card::Title+ to still preseve the default
12-
# rendering:
13-
#
10+
# @example Using the title slot
1411
# <%= render(Flowbite::Card.new) do |card| %>
1512
# <% card.with_title do %>
1613
# <div><%= parent_category.name %></div>
@@ -20,6 +17,8 @@ module Flowbite
2017
#
2118
# @viewcomponent_slot [Flowbite::Card::Title] title The title of the card,
2219
# rendered at the top. Use +with_title+ to set custom content.
20+
#
21+
# @lookbook_embed CardPreview
2322
class Card < ViewComponent::Base
2423
renders_one :title
2524

app/components/flowbite/input_field.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ module Flowbite
6262
# Usually auto-generated based on the input type subclass.
6363
# @viewcomponent_slot [Flowbite::Input::Label] label The label for the input
6464
# field, rendered above the input element.
65+
#
66+
# @lookbook_embed InputFieldPreview
6567
class InputField < ViewComponent::Base
6668
renders_one :hint
6769
renders_one :input

app/components/flowbite/link.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Flowbite
55
# to an external website when clicking on an inline text item, button, or card
66
#
77
# Use this component to add default styles to an inline link element.
8+
#
9+
# @lookbook_embed LinkPreview
810
class Link < ViewComponent::Base
911
attr_reader :href, :options
1012

app/components/flowbite/toast.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module Flowbite
1010
# @param message [String] The message to display in the toast.
1111
# @param options [Hash] Additional HTML options for the toast container.
1212
# @param style [Symbol] The color style of the toast (:default, :success, :danger, :warning).
13+
#
14+
# @lookbook_embed ToastPreview
1315
class Toast < ViewComponent::Base
1416
class << self
1517
def classes

demo/.yardoc/checksums

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
app/components/flowbite/card.rb fb108e57eb6e0ce250db89c409f3f79ed4e7fe70
2-
app/components/flowbite/link.rb 7c83a929ccbe4035def17fe928aff4e042dc2999
1+
app/components/flowbite/card.rb 6f248428402ae1a72982cd0cde3acd77a6f43308
2+
app/components/flowbite/link.rb 1516522405f7cf2021913a4ebbb792f4ae386c16
33
app/components/flowbite/input.rb 6fbe49459aa61f71e7fb72688372223189167ac7
44
app/components/flowbite/style.rb ef063360cc99cd7a6b8e67a7693326bb5dfb0e42
5-
app/components/flowbite/toast.rb 20c14599e8a9f33cf36450edbad59b3dbeaf6bbd
5+
app/components/flowbite/toast.rb 5847b4e1b7387f27f7bc65c8098f132b9fdf0c86
66
app/components/flowbite/button.rb 6ae7681d3b842d73aa99cddfa5a9b107ede7fea4
77
app/components/flowbite/styles.rb 929c42e428ba5a8e16efacaae0f35380e2f5f95c
88
app/components/flowbite/input/url.rb f1046824f9b06c8df8e0f567979321b82baac6fa
@@ -16,7 +16,7 @@ app/components/flowbite/button/pill.rb 5200da68b3fdd353db3780550b932f4037a7c999
1616
app/components/flowbite/input/email.rb c89f74f38cdefce5c05bac458b39d56a9ba4aa35
1717
app/components/flowbite/input/label.rb d71e843b267f35f10c3627e950408493a9afa97c
1818
app/components/flowbite/input/phone.rb 0dfe3e9a83c4fb9f558405a20601649c7b08922a
19-
app/components/flowbite/input_field.rb 4e6b2c2c744d54a8c645b31098a3aee60d402f43
19+
app/components/flowbite/input_field.rb 529d2ff113db8644c345e32994e62366479c8cb0
2020
app/components/flowbite/input/number.rb a33580788ad91308b85955fdb44d37883329dd4e
2121
app/components/flowbite/input/select.rb 9f1a6406efdda2e29d479117a35c2a924bd888c2
2222
app/components/flowbite/button/outline.rb 2829cf352a03c00dd99a56a05181c4e1a6794d18

demo/.yardoc/objects/root.dat

119 Bytes
Binary file not shown.

demo/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ../..
33
specs:
4-
flowbite-components (0.1.4)
4+
flowbite-components (0.2.0)
55
view_component (>= 4.0.0)
66

77
GEM

demo/app/controllers/docs/components_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ def show
3535
private
3636

3737
helper_method def all_components
38+
return @all_components if @all_components
39+
3840
flowbite = Yard.new.code_object("Flowbite")
3941
child_classes = flowbite.children.select { |child|
4042
child.type == :class && child.inheritance_tree.map(&:path).include?("ViewComponent::Base")
4143
}
42-
child_classes.sort_by(&:name)
44+
45+
@all_components = child_classes.sort_by(&:name)
4346
end
4447

4548
helper_method def rubydoc_url(code_object)

demo/app/views/docs/components/show.html.erb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@
5454
<%= simple_format(@code_object.docstring) %>
5555
</section>
5656

57+
<% if @lookbook_embeds.any? %>
58+
<section>
59+
<h2 class="mt-8 text-2xl font-bold">Examples</h2>
60+
61+
<% @lookbook_embeds.each do |lookbook_tag| %>
62+
<lookbook-embed panels="source" preview="<%= lookbook_tag.text.strip %>" scenario="*"></lookbook-embed>
63+
<% end %>
64+
</section>
65+
<% end %>
66+
5767
<% if @viewcomponent_slots.any? %>
5868
<section>
5969
<h2 class="mt-8 text-2xl font-bold">Slots</h2>
@@ -79,16 +89,6 @@
7989
</section>
8090
<% end %>
8191

82-
<% if @lookbook_embeds.any? %>
83-
<section>
84-
<h2 class="mt-8 text-2xl font-bold">Examples</h2>
85-
86-
<% @lookbook_embeds.each do |lookbook_tag| %>
87-
<lookbook-embed panels="source" preview="<%= lookbook_tag.text.strip %>" scenario="*"></lookbook-embed>
88-
<% end %>
89-
</section>
90-
<% end %>
91-
9292
<% if @constructor %>
9393
<section>
9494
<h2 class="mt-8 text-2xl font-bold">Constructor</h2>

demo/app/views/homepage/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
sm:space-y-0
2222
"
2323
>
24-
<%= link_to("https://github.com/substancelab/flowbite-components?tab=readme-ov-file#installation", class: Flowbite::Button.classes(size: :lg) + ["inline-flex", "justify-center", "items-center"]) do %>
24+
<%= link_to(docs_page_path(:getting_started), class: Flowbite::Button.classes(size: :lg) + ["inline-flex", "justify-center", "items-center"]) do %>
2525
Get started
2626
<svg
2727
class="w-3.5 h-3.5 ms-2 rtl:rotate-180"
@@ -40,7 +40,7 @@
4040
</svg>
4141
<% end %>
4242

43-
<%= link_to(lookbook_path, class: Flowbite::Button.classes(size: :lg, style: :secondary)) do %>
43+
<%= link_to(docs_component_path("Flowbite"), class: Flowbite::Button.classes(size: :lg, style: :secondary)) do %>
4444
View components
4545
<% end %>
4646
</div>

0 commit comments

Comments
 (0)