Class: SolidusAdmin::UI::Toggletip::Component

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/solidus_admin/ui/toggletip/component.rb

Constant Summary collapse

POSITIONS =
{
  below: {
    arrow: "before:top-0 before:left-1/2 before:translate-y-[-50%] before:translate-x-[-50%]",
    bubble: "translate-x-[calc(-50%+(1rem/2))] translate-y-[calc(0.375rem/2)]"
  },
  above: {
    arrow: "before:bottom-0 before:left-1/2 before:translate-y-[50%] before:translate-x-[-50%]",
    bubble: "translate-x-[calc(-50%+(1rem/2))] translate-y-[calc(-100%-1rem-(0.375rem/2))]"
  },
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(text:, position: :above, **attributes) ⇒ Component

Returns a new instance of Component.



15
16
17
18
19
20
# File 'app/components/solidus_admin/ui/toggletip/component.rb', line 15

def initialize(text:, position: :above, **attributes)
  @text = text
  @position = position
  @attributes = attributes
  @attributes[:class] = "relative inline-block #{@attributes[:class]}"
end