Class: ShadcnPhlexcomponents::HoverCardContent

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/hover_card.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(side: :bottom, align: :center, **attributes) ⇒ HoverCardContent

Returns a new instance of HoverCardContent.



95
96
97
98
99
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 95

def initialize(side: :bottom, align: :center, **attributes)
  @side = side
  @align = align
  super(**attributes)
end

Instance Method Details

#default_attributes ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 101

def default_attributes
  {
    tabindex: -1,
    data: {
      side: @side,
      align: @align,
      hover_card_target: "content",
      action: "mouseover->hover-card#open mouseout->hover-card#close",
    },
  }
end

#view_template ⇒ Object



113
114
115
116
117
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 113

def view_template(&)
  HoverCardContentContainer do
    div(**@attributes, &)
  end
end