Class: PhlexKit::Marker
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::Marker
- Defined in:
- app/components/phlex_kit/marker/marker.rb
Overview
Conversation annotation, ported from shadcn/ui's Marker (an AI-chat-era
addition): an inline status line, bordered system-note row, or labeled
separator. Compose Marker(variant:) > [MarkerIcon +] MarkerContent.
href: renders an , as: :button a
Constant Summary collapse
- VARIANTS =
{ default: nil, border: "border", separator: "separator" }.freeze
Instance Method Summary collapse
-
#initialize(variant: :default, href: nil, as: :div, **attrs) ⇒ Marker
constructor
A new instance of Marker.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(variant: :default, href: nil, as: :div, **attrs) ⇒ Marker
Returns a new instance of Marker.
10 11 12 13 14 15 |
# File 'app/components/phlex_kit/marker/marker.rb', line 10 def initialize(variant: :default, href: nil, as: :div, **attrs) @variant = variant.to_sym @href = href @as = as.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/phlex_kit/marker/marker.rb', line 17 def view_template(&) classes = [ "pk-marker", fetch_option(VARIANTS, @variant, :variant) ].compact.join(" ") if @href a(**mix({ class: classes, href: @href }, @attrs), &) elsif @as == :button (**mix({ class: classes, type: "button" }, @attrs), &) else div(**mix({ class: classes }, @attrs), &) end end |