Class: Flowbite::Card
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Card
- Defined in:
- app/components/flowbite/card.rb
Overview
Renders a card element.
Class Method Summary collapse
- .classes(state: :default, style: :default) ⇒ Object
-
.styles ⇒ Object
rubocop:disable Layout/LineLength.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(class: [], options: {}) ⇒ Card
constructor
A new instance of Card.
Constructor Details
#initialize(class: [], options: {}) ⇒ Card
Returns a new instance of Card.
40 41 42 43 |
# File 'app/components/flowbite/card.rb', line 40 def initialize(class: [], options: {}) @class = Array(binding.local_variable_get(:class)) || [] = || {} end |
Class Method Details
.classes(state: :default, style: :default) ⇒ Object
9 10 11 12 |
# File 'app/components/flowbite/card.rb', line 9 def classes(state: :default, style: :default) style = styles.fetch(style) style.fetch(state) end |
.styles ⇒ Object
rubocop:disable Layout/LineLength
15 16 17 18 19 20 21 |
# File 'app/components/flowbite/card.rb', line 15 def styles { default: Flowbite::Style.new( default: ["p-6", "bg-white", "border", "border-gray-200", "rounded-lg", "shadow-sm", "dark:bg-gray-800", "dark:border-gray-700"] ) }.freeze end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/components/flowbite/card.rb', line 25 def call = {} [:class] = self.class.classes + @class content_tag(:div, .merge()) do concat(content_tag(:div, content, class: "font-normal text-gray-700 dark:text-gray-400")) end end |