Class: Shadcn::Marker::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Marker::Component
- Defined in:
- app/components/shadcn/marker/component.rb
Overview
Port of registry/new-york-v4/ui/marker.tsx
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(variant: :default, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(variant: :default, **attributes) ⇒ Component
Returns a new instance of Component.
32 33 34 35 |
# File 'app/components/shadcn/marker/component.rb', line 32 def initialize(variant: :default, **attributes) @variant = variant&.to_sym || :default super(**attributes) end |
Instance Attribute Details
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
30 31 32 |
# File 'app/components/shadcn/marker/component.rb', line 30 def variant @variant end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
41 42 43 |
# File 'app/components/shadcn/marker/component.rb', line 41 def element_attributes(**defaults) super(**{ "data-variant" => variant }.merge(defaults)) end |
#style_variants ⇒ Object
37 38 39 |
# File 'app/components/shadcn/marker/component.rb', line 37 def style_variants { variant: } end |