Class: Shadcn::Attachment::Trigger::Component

Inherits:
Shadcn::ApplicationViewComponent show all
Defined in:
app/components/shadcn/attachment/trigger/component.rb

Overview

AttachmentTrigger — a transparent button stretched over the whole attachment, so the card is clickable without nesting a button inside the actions that already sit on top of it (attachment-actions carries z-20 against this one's z-10).

Its own file for the type: upstream sets type="button" only when it is really a <button>, and leaves it off when asChild makes it something else (attachment.tsx:174). as: is this gem's asChild, so the same condition is tag_name == :button.

Constant Summary

Constants inherited from Shadcn::ApplicationViewComponent

Shadcn::ApplicationViewComponent::CONTENTS_STYLE, Shadcn::ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from Shadcn::ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from Shadcn::ApplicationViewComponent

#call, #css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

This class inherits a constructor from Shadcn::ApplicationViewComponent

Instance Method Details

#element_attributes(**defaults) ⇒ Object



23
24
25
26
27
# File 'app/components/shadcn/attachment/trigger/component.rb', line 23

def element_attributes(**defaults)
  return super(**defaults) if tag_name.to_sym != :button

  super(**{ type: "button" }.merge(defaults))
end