Skip to content

Commit 646d425

Browse files
authored
Merge pull request #72 from substancelab/cleanup_breadcrumb
Move breadcrumb icons inside breadcrumb namespace
2 parents 9bdc030 + f7bb53c commit 646d425

File tree

11 files changed

+83
-78
lines changed

11 files changed

+83
-78
lines changed

app/components/flowbite/breadcrumb.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ module Flowbite
88
# Breadcrumbs consist of the following components:
99
#
1010
# - {Flowbite::Breadcrumb}: Container for breadcrumb items.
11+
# - {Flowbite::Breadcrumb::HomeIcon}: Home icon for the first breadcrumb item.
12+
# - {Flowbite::Breadcrumb::SeparatorIcon}: Separator between breadcrumb items.
1113
# - {Flowbite::BreadcrumbItem}: An individual breadcrumb item.
12-
# - {Flowbite::BreadcrumbItem::First}: An individual breadcrumb item with a home icon on it.
13-
# - {Flowbite::BreadcrumbSeparator}: Separator between breadcrumb items.
1414
# - {Flowbite::BreadcrumbItem::Current}: An invidual breadcrumb item without a link, usually used for the current page in the breadcrumb trail.
15+
# - {Flowbite::BreadcrumbItem::First}: An individual breadcrumb item with a home icon on it.
1516
#
1617
# == Slots
1718
#
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
module Flowbite
4+
class Breadcrumb
5+
# Renders a breadcrumb home icon.
6+
#
7+
# This is typically used as a prefix icon in the first breadcrumb item,
8+
# but can be used standalone if needed.
9+
#
10+
# @example Standalone usage
11+
# <%= render Flowbite::Breadcrumb::HomeIcon.new %>
12+
class HomeIcon < ViewComponent::Base
13+
def call
14+
tag.svg(
15+
class: "w-3 h-3 me-2.5",
16+
"aria-hidden": "true",
17+
xmlns: "http://www.w3.org/2000/svg",
18+
fill: "currentColor",
19+
viewBox: "0 0 20 20"
20+
) do
21+
tag.path(
22+
d: "m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z"
23+
)
24+
end
25+
end
26+
end
27+
end
28+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
module Flowbite
4+
class Breadcrumb
5+
# Renders a breadcrumb separator icon.
6+
#
7+
# This is automatically used by BreadcrumbItem components, but can be
8+
# used standalone if needed.
9+
#
10+
# @example Standalone usage
11+
# <%= render Flowbite::Breadcrumb::SeparatorIcon.new %>
12+
class SeparatorIcon < ViewComponent::Base
13+
def call
14+
tag.svg(
15+
class: "w-3.5 h-3.5 rtl:rotate-180 text-body",
16+
"aria-hidden": "true",
17+
xmlns: "http://www.w3.org/2000/svg",
18+
fill: "none",
19+
height: 24,
20+
viewBox: "0 0 24 24",
21+
width: 24
22+
) do
23+
tag.path(
24+
stroke: "currentColor",
25+
"stroke-linecap": "round",
26+
"stroke-linejoin": "round",
27+
"stroke-width": "2",
28+
d: "m9 5 7 7-7 7"
29+
)
30+
end
31+
end
32+
end
33+
end
34+
end

app/components/flowbite/breadcrumb_home.rb

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/components/flowbite/breadcrumb_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def item_options
3333
end
3434

3535
def prefix_icon
36-
Flowbite::BreadcrumbSeparator.new
36+
Flowbite::Breadcrumb::SeparatorIcon.new
3737
end
3838

3939
def render_link

app/components/flowbite/breadcrumb_item/first.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def prefix_icon
2626
end
2727

2828
def render_link
29-
icon = render(Flowbite::BreadcrumbHome.new)
29+
icon = render(Flowbite::Breadcrumb::HomeIcon.new)
3030
link_options = {class: link_classes}.merge(options)
3131
content_tag(:a, safe_join([icon, content]), href: href, **link_options)
3232
end

app/components/flowbite/breadcrumb_separator.rb

Lines changed: 0 additions & 32 deletions
This file was deleted.

demo/.yardoc/checksums

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ app/components/flowbite/toast.rb 20c14599e8a9f33cf36450edbad59b3dbeaf6bbd
55
app/components/flowbite/button.rb 6ae7681d3b842d73aa99cddfa5a9b107ede7fea4
66
app/components/flowbite/styles.rb 929c42e428ba5a8e16efacaae0f35380e2f5f95c
77
app/components/flowbite/input/url.rb 2ad9461aaa799e0ce457279df1bd63641b845e95
8-
app/components/flowbite/breadcrumb.rb 441182d24e60cca44541ae62c19d80cb9dbf87a9
8+
app/components/flowbite/breadcrumb.rb 307d50aa45f8ace7b76b19e19907d74c1733e3c7
99
app/components/flowbite/card/title.rb 8067aa1e027c725896b063b67364aecfbf2f7d4e
1010
app/components/flowbite/input/date.rb 5b93e5b98eef5e6e54ef18e74c72fb8746bac48b
1111
app/components/flowbite/input/file.rb fde42ca92377f212397f350cca288a9c80de7b8a
@@ -23,8 +23,7 @@ app/components/flowbite/button/outline.rb 2829cf352a03c00dd99a56a05181c4e1a6794d
2323
app/components/flowbite/input/checkbox.rb 6102546a7d3ecc15d8365444c51b8236aea503a6
2424
app/components/flowbite/input/password.rb a25f6a942c51960bc4d2e1a5b3922e6bdaac64c0
2525
app/components/flowbite/input/textarea.rb 9acc6202df28909993fd984479af686f46da6f38
26-
app/components/flowbite/breadcrumb_home.rb 6e2e81b5c93b83acc9dcd1b3af60a2252918e064
27-
app/components/flowbite/breadcrumb_item.rb 2706bc28cf6f4584abc275ec0dd41a108b50489a
26+
app/components/flowbite/breadcrumb_item.rb d7e802764edce7341a279a0a50d2600a517e0f8c
2827
app/components/flowbite/input/date_time.rb ac19cace72a0bca01064d96cdd0cacd791010170
2928
app/components/flowbite/input_field/url.rb f996ebbec1d25ad845bc319185d6c26ffef8623f
3029
app/components/flowbite/input_field/date.rb aa5cc03287db78709f20d33d35eb0ddf7b8bcdc5
@@ -35,12 +34,13 @@ app/components/flowbite/input_field/phone.rb 6a3da98a2dded98b1c4d14c2419077fc9de
3534
app/components/flowbite/input/radio_button.rb 40ea73beb1d0fe939b29df1cee5a566966157b9e
3635
app/components/flowbite/input_field/number.rb 32dce4e2bb586f64229dc78b541700df829068c7
3736
app/components/flowbite/input_field/select.rb 1f9788b5fff4be2b65184e73e739da8fa9de0264
38-
app/components/flowbite/breadcrumb_separator.rb ac057ef44dd4881b951be1d739c58ac26c4c0828
37+
app/components/flowbite/breadcrumb/home_icon.rb cc39c1f07e2bca4f745f5e66421da0592f1b6f72
3938
app/components/flowbite/input_field/checkbox.rb 4cbc6f541842838234189b383f813b164a06379b
4039
app/components/flowbite/input_field/password.rb 37e592f55f258cc4b81859d48763b9c0eff12f61
4140
app/components/flowbite/input_field/textarea.rb 52626e199b25b723b4d5355028d6bc3d7a167cd1
42-
app/components/flowbite/breadcrumb_item/first.rb 481b98ae963e304882a7513a19ba6f86495d32f1
41+
app/components/flowbite/breadcrumb_item/first.rb 329e12fe74148850c98d14d333bd94be95216f32
4342
app/components/flowbite/input_field/date_time.rb 0a17d49d70f3ba820fee0f8930115540f12d72e2
4443
app/components/flowbite/input/validation_error.rb 8536d2116ed276871df806e04a739218a01d62e7
4544
app/components/flowbite/breadcrumb_item/current.rb bcab74f021197c3286dff7d3ffb8528d676101bd
4645
app/components/flowbite/input_field/radio_button.rb adc482ad312c4c16b206bb10e566e96d709a7a2f
46+
app/components/flowbite/breadcrumb/separator_icon.rb 12d420399049da3c80ef4f03ce28807ec4ffd53f

demo/.yardoc/object_types

24 Bytes
Binary file not shown.

demo/.yardoc/objects/root.dat

276 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)