Class: PhlexKit::Item
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::Item
- Defined in:
- app/components/phlex_kit/item/item.rb
Overview
List row, ported from shadcn/ui's Item: a flex row of ItemMedia +
ItemContent(ItemTitle + ItemDescription) + ItemActions, optionally grouped
in an ItemGroup. variant :outline draws a bordered card row.
.pk-item* (item.css).
Constant Summary collapse
- VARIANTS =
{ default: nil, outline: "outline", muted: "muted" }.freeze
Instance Method Summary collapse
-
#initialize(variant: :default, **attrs) ⇒ Item
constructor
A new instance of Item.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(variant: :default, **attrs) ⇒ Item
Returns a new instance of Item.
9 10 11 12 |
# File 'app/components/phlex_kit/item/item.rb', line 9 def initialize(variant: :default, **attrs) @variant = variant.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
14 15 16 |
# File 'app/components/phlex_kit/item/item.rb', line 14 def view_template(&) div(**mix({ class: [ "pk-item", VARIANTS.fetch(@variant) ].compact.join(" ") }, @attrs), &) end |