Class: Shadcn::SidebarTriggerComponent

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

Overview

SidebarTrigger component - button to toggle sidebar open/closed

Constant Summary collapse

BASE_CLASSES =
"h-7 w-7"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content, #initialize

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

This class inherits a constructor from Shadcn::BaseComponent

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/components/shadcn/sidebar_trigger_component.rb', line 8

def call
  render ButtonComponent.new(
    variant: :ghost,
    size: :icon,
    class_name: cn(BASE_CLASSES, class_name),
    data: { sidebar: "trigger", action: "click->shadcn--sidebar#toggle" },
    **html_options
  ) do
    trigger_content
  end
end