Class: Shadcn::Bubble::Reactions::Component

Inherits:
ApplicationViewComponent show all
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

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

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

#alignObject (readonly)

Returns the value of attribute align.



36
37
38
# File 'app/components/shadcn/bubble/reactions/component.rb', line 36

def align
  @align
end

#sideObject (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_variantsObject



44
45
46
# File 'app/components/shadcn/bubble/reactions/component.rb', line 44

def style_variants
  { side:, align: }
end