Class: Flowbite::Badge::Dot
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Badge::Dot
- Defined in:
- app/components/flowbite/badge/dot.rb
Overview
Renders a colored dot indicator for use inside a badge.
Constant Summary collapse
- CLASSES =
{ alternative: ["bg-heading", "me-1", "rounded-full"], brand: ["bg-fg-brand-strong", "me-1", "rounded-full"], danger: ["bg-fg-danger-strong", "me-1", "rounded-full"], gray: ["bg-heading", "me-1", "rounded-full"], success: ["bg-fg-success-strong", "me-1", "rounded-full"], warning: ["bg-fg-warning", "me-1", "rounded-full"] }.freeze
- SIZES =
{ default: ["h-1.5", "w-1.5"] }.freeze
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(size: :default, style: :brand) ⇒ Dot
constructor
A new instance of Dot.
Constructor Details
#initialize(size: :default, style: :brand) ⇒ Dot
Returns a new instance of Dot.
35 36 37 38 |
# File 'app/components/flowbite/badge/dot.rb', line 35 def initialize(size: :default, style: :brand) @size = size @style = style end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
33 34 35 |
# File 'app/components/flowbite/badge/dot.rb', line 33 def size @size end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
33 34 35 |
# File 'app/components/flowbite/badge/dot.rb', line 33 def style @style end |
Class Method Details
.classes(size: :default, style: :brand) ⇒ Object
24 25 26 |
# File 'app/components/flowbite/badge/dot.rb', line 24 def classes(size: :default, style: :brand) CLASSES.fetch(style) + sizes.fetch(size) end |
.sizes ⇒ Object
28 29 30 |
# File 'app/components/flowbite/badge/dot.rb', line 28 def sizes SIZES end |
Instance Method Details
#call ⇒ Object
40 41 42 |
# File 'app/components/flowbite/badge/dot.rb', line 40 def call content_tag(:span, nil, class: self.class.classes(size: size, style: style)) end |