Class: Shadcn::Bubble::Reactions::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Bubble::Reactions::Component
- Defined in:
- app/components/shadcn/bubble/reactions/component.rb
Overview
BubbleReactions — the pill of emoji that overlaps a bubble's corner.
Two independent axes, so two variants groups rather than one
(bubble.tsx:85-103).
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.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(side: :bottom, align: :end, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(side: :bottom, align: :end, **attributes) ⇒ Component
Returns a new instance of Component.
38 39 40 41 42 |
# File 'app/components/shadcn/bubble/reactions/component.rb', line 38 def initialize(side: :bottom, align: :end, **attributes) @side = side&.to_sym || :bottom @align = align&.to_sym || :end super(**attributes) end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
36 37 38 |
# File 'app/components/shadcn/bubble/reactions/component.rb', line 36 def align @align end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
36 37 38 |
# File 'app/components/shadcn/bubble/reactions/component.rb', line 36 def side @side end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
48 49 50 |
# File 'app/components/shadcn/bubble/reactions/component.rb', line 48 def element_attributes(**defaults) super(**{ "data-align" => align, "data-side" => side }.merge(defaults)) end |
#style_variants ⇒ Object
44 45 46 |
# File 'app/components/shadcn/bubble/reactions/component.rb', line 44 def style_variants { side:, align: } end |