Class: Shadcn::Message::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Message::Component
- Defined in:
- app/components/shadcn/message/component.rb
Overview
Port of registry/new-york-v4/ui/message.tsx
align: is not a cva variant upstream — the classes are one string and the
side is chosen by data-[align=end]:flex-row-reverse reading the attribute
this writes (message.tsx:23-26). Its own file all the same, because a
computed attribute is exactly what part does not do.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(align: :start, **attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(align: :start, **attributes) ⇒ Component
Returns a new instance of Component.
23 24 25 26 |
# File 'app/components/shadcn/message/component.rb', line 23 def initialize(align: :start, **attributes) @align = align&.to_sym || :start super(**attributes) end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
21 22 23 |
# File 'app/components/shadcn/message/component.rb', line 21 def align @align end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
28 29 30 |
# File 'app/components/shadcn/message/component.rb', line 28 def element_attributes(**defaults) super(**{ "data-align" => align }.merge(defaults)) end |