Class: Shadcn::HoverCardContentComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/hover_card_content_component.rb

Overview

Hover Card Content component

Constant Summary collapse

BASE_CLASSES =
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(side: :bottom, align: :center, **options, &block) ⇒ HoverCardContentComponent

Returns a new instance of HoverCardContentComponent.

Parameters:

  • side (Symbol) (defaults to: :bottom)

    :top, :right, :bottom, or :left

  • align (Symbol) (defaults to: :center)

    :start, :center, or :end



10
11
12
13
14
# File 'app/components/shadcn/hover_card_content_component.rb', line 10

def initialize(side: :bottom, align: :center, **options, &block)
  super(**options, &block)
  @side = side
  @align = align
end

Instance Method Details

#callObject



16
17
18
# File 'app/components/shadcn/hover_card_content_component.rb', line 16

def call
  (:div, content, content_attributes)
end