Skip to content

Commit f915bde

Browse files
authored
Merge pull request #81 from substancelab/docs
Improve documentation visuals
2 parents efd0d4b + ad2140a commit f915bde

File tree

30 files changed

+457
-78
lines changed

30 files changed

+457
-78
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ gem "decant"
2121
gem "kramdown"
2222
gem "kramdown-parser-gfm"
2323
gem "lookbook", ">= 2.3.11"
24+
gem "rails_autolink"

app/components/flowbite/breadcrumb.rb

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,41 @@
33
module Flowbite
44
# Renders a breadcrumb navigation component.
55
#
6-
# See https://flowbite.com/docs/components/breadcrumb/
7-
#
8-
# Use {Flowbite::Breadcrumb} and the child {Flowbite::Breadcrumb::Item} components to create and indicate a series of page structure and URLs to help the user navigate through the website.
6+
# Use {Flowbite::Breadcrumb} and the child {Flowbite::Breadcrumb::Item}
7+
# components to create and indicate a series of page structure and URLs to
8+
# help the user navigate through the website.
99
#
1010
# Breadcrumbs consist of the following components:
1111
#
1212
# - {Flowbite::Breadcrumb}: Container for breadcrumb items.
1313
# - {Flowbite::Breadcrumb::HomeIcon}: Home icon for the first breadcrumb item.
1414
# - {Flowbite::Breadcrumb::SeparatorIcon}: Separator between breadcrumb items.
1515
# - {Flowbite::Breadcrumb::Item}: An individual breadcrumb item.
16-
# - {Flowbite::Breadcrumb::Item::Current}: An invidual breadcrumb item without a link, usually used for the current page in the breadcrumb trail.
17-
# - {Flowbite::Breadcrumb::Item::First}: An individual breadcrumb item with a home icon on it.
16+
# - {Flowbite::Breadcrumb::Item::Current}: An individual breadcrumb item
17+
# without a link, usually used for the current page in the breadcrumb trail.
18+
# - {Flowbite::Breadcrumb::Item::First}: An individual breadcrumb item with a
19+
# home icon on it.
20+
#
21+
# @example Usage
22+
# <%= render(Flowbite::Breadcrumb.new) do |breadcrumb| %>
23+
# <% breadcrumb.with_item do %>
24+
# <%= render(Flowbite::Breadcrumb::Item::First.new(href: "/")) { "Root page" } %>
25+
# <% end %>
26+
# <% breadcrumb.with_item do %>
27+
# <%= render(Flowbite::Breadcrumb::Item.new(href: "/projects")) { "Parent page" } %>
28+
# <% end %>
29+
# <% breadcrumb.with_item do %>
30+
# <%= render(Flowbite::Breadcrumb::Item::Current.new) { "Current Page" } %>
31+
# <% end %>
32+
# <% end %>
1833
#
1934
# @viewcomponent_slot [Flowbite::Breadcrumb::Item] items The items of the
2035
# breadcrumb trail. Use {Flowbite::Breadcrumb::Item::First} for the first
2136
# item to get a home icon, and {Flowbite::Breadcrumb::Item::Current} for the
2237
# last item to render it without a link.
2338
#
2439
# @lookbook_embed BreadcrumbPreview
40+
# @see https://flowbite.com/docs/components/breadcrumb/
2541
class Breadcrumb < ViewComponent::Base
2642
renders_many :items
2743

app/components/flowbite/card.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
module Flowbite
44
# Renders a card element.
55
#
6-
# See https://flowbite.com/docs/components/cards/
7-
#
86
# To render a title in the card, use the title argument or the title slot.
97
#
108
# @example Using the title slot
@@ -18,6 +16,7 @@ module Flowbite
1816
# @viewcomponent_slot [Flowbite::Card::Title] title The title of the card,
1917
# rendered at the top. Use +with_title+ to set custom content.
2018
#
19+
# @see https://flowbite.com/docs/components/cards/
2120
# @lookbook_embed CardPreview
2221
class Card < ViewComponent::Base
2322
renders_one :title

app/components/flowbite/input.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ module Flowbite
66
#
77
# Use this when you want to render an input field on its own without any
88
# surrounding elements, i.e. as a building block in more complex input
9-
# components.
10-
#
11-
# To render a complete input field with labels and error messages, use
12-
# {Flowbite::InputField} instead.
9+
# components. To render a complete input field with labels and error messages,
10+
# use {Flowbite::InputField} instead.
1311
#
1412
# By default this renders a text input field. To render other types of input
1513
# fields, use one of the subclasses, such as {Flowbite::Input::Checkbox} or
1614
# {Flowbite::Input::Textarea}.
15+
#
16+
# @example Usage
17+
# <%= render(Flowbite::Input::Email.new(attribute: :email, form: form)) %>
18+
#
19+
# @lookbook_embed InputPreview
1720
class Input < ViewComponent::Base
1821
SIZES = {
1922
sm: ["px-2.5", "py-2", "text-sm"],

app/components/flowbite/input_field.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module Flowbite
2020
# {Flowbite::Input} instead and one of its subclasses.
2121
#
2222
# @example Basic usage
23-
#
2423
# <% form_for @person do |form| %>
2524
# <%= render(
2625
# Flowbite::InputField::Number.new(
@@ -31,7 +30,6 @@ module Flowbite
3130
# <% end %>
3231
#
3332
# @example Kitchen sink
34-
#
3533
# <% form_for @person do |form| %>
3634
# <%= render(
3735
# Flowbite::InputField::Number.new(

app/components/flowbite/toast.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
module Flowbite
44
# Renders a toast notification element.
55
#
6-
# See https://flowbite.com/docs/components/toast/
7-
#
8-
# @param class [Array<String>] Additional CSS classes for the toast container.
9-
# @param dismissible [Boolean] Whether the toast can be dismissed (default: true).
10-
# @param message [String] The message to display in the toast.
11-
# @param options [Hash] Additional HTML options for the toast container.
12-
# @param style [Symbol] The color style of the toast (:default, :success, :danger, :warning).
6+
# @example Usage
7+
# <%= render(Flowbite::Toast.new(message: "Something has happened!")) %>
138
#
9+
# @see https://flowbite.com/docs/components/toast/
1410
# @lookbook_embed ToastPreview
1511
class Toast < ViewComponent::Base
1612
class << self
@@ -21,6 +17,11 @@ def classes
2117

2218
attr_reader :dismissible, :message, :options, :style
2319

20+
# @param class [Array<String>] Additional CSS classes for the toast container.
21+
# @param dismissible [Boolean] Whether the toast can be dismissed (default: true).
22+
# @param message [String] The message to display in the toast.
23+
# @param options [Hash] Additional HTML options for the toast container.
24+
# @param style [Symbol] The color style of the toast (:default, :success, :danger, :warning).
2425
def initialize(message:, dismissible: true, style: :default, class: nil, **options)
2526
@message = message
2627
@style = style

demo/.yardoc/checksums

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
app/components/flowbite/card.rb 6f248428402ae1a72982cd0cde3acd77a6f43308
1+
app/components/flowbite/card.rb 9fe54b52bc9d177c2ec1d9e68e0a397b8a327744
22
app/components/flowbite/link.rb 1516522405f7cf2021913a4ebbb792f4ae386c16
3-
app/components/flowbite/input.rb 6fbe49459aa61f71e7fb72688372223189167ac7
3+
app/components/flowbite/input.rb df2ae5f59a7d33a635599632386053f999f65919
44
app/components/flowbite/style.rb ef063360cc99cd7a6b8e67a7693326bb5dfb0e42
5-
app/components/flowbite/toast.rb 5847b4e1b7387f27f7bc65c8098f132b9fdf0c86
5+
app/components/flowbite/toast.rb 6b822405dd55d87d56979e6cfba55e8f73965047
66
app/components/flowbite/button.rb 6ae7681d3b842d73aa99cddfa5a9b107ede7fea4
77
app/components/flowbite/styles.rb 929c42e428ba5a8e16efacaae0f35380e2f5f95c
88
app/components/flowbite/input/url.rb f1046824f9b06c8df8e0f567979321b82baac6fa
9-
app/components/flowbite/breadcrumb.rb 95b9f165154d4a3e4029fe33b7663d7d7302ba98
9+
app/components/flowbite/breadcrumb.rb c69ffb465b6e7f2489d4ac9a928e08bdf252fe99
1010
app/components/flowbite/card/title.rb 8067aa1e027c725896b063b67364aecfbf2f7d4e
1111
app/components/flowbite/input/date.rb 3b47f26b5622267e772c0d42d37655336ddf0169
1212
app/components/flowbite/input/file.rb 538334cde553b4c74456716e35353c6c26467646
@@ -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 529d2ff113db8644c345e32994e62366479c8cb0
19+
app/components/flowbite/input_field.rb 8ef98ace7d4ccb4f474d3063cf48cc5c83cd8068
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

1.58 KB
Binary file not shown.

demo/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ gem "decant"
1919
gem "kramdown"
2020
gem "kramdown-parser-gfm"
2121
gem "lookbook", ">= 2.3.11"
22+
gem "rails_autolink"
2223

2324
group :development, :test do
2425
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem

demo/Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ GEM
224224
rails-html-sanitizer (1.6.2)
225225
loofah (~> 2.21)
226226
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
227+
rails_autolink (1.1.8)
228+
actionview (> 3.1)
229+
activesupport (> 3.1)
230+
railties (> 3.1)
227231
railties (8.0.2.1)
228232
actionpack (= 8.0.2.1)
229233
activesupport (= 8.0.2.1)
@@ -305,6 +309,7 @@ DEPENDENCIES
305309
propshaft
306310
puma (>= 5.0)
307311
rails (~> 8.0.2)
312+
rails_autolink
308313
sqlite3 (>= 2.1)
309314
tailwindcss-rails (~> 4.3)
310315
tzinfo-data

0 commit comments

Comments
 (0)