Class: ShadcnPhlexcomponents::TooltipArrow

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/tooltip.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, #initialize, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

This class inherits a constructor from ShadcnPhlexcomponents::Base

Instance Method Details

#default_attributes ⇒ Object



149
150
151
152
153
154
155
156
# File 'lib/shadcn_phlexcomponents/components/tooltip.rb', line 149

def default_attributes
  {
    width: 10,
    height: 5,
    viewBox: "0 0 30 10",
    preserveAspectRatio: "none",
  }
end

#view_template ⇒ Object



158
159
160
161
162
163
164
165
# File 'lib/shadcn_phlexcomponents/components/tooltip.rb', line 158

def view_template
  span(data: { tooltip_target: "arrow" }) do
    svg(**@attributes) do
      # Weird bug with phlex where it's throwing a undefined method "polygon"
      raw(safe('<polygon points="0,0 30,0 15,10"></polygon>'))
    end
  end
end