Class: Shadcn::SidebarMenuSubButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::SidebarMenuSubButtonComponent
- Defined in:
- app/components/shadcn/sidebar_menu_sub_button_component.rb
Overview
SidebarMenuSubButton component - button within submenu item
Constant Summary collapse
- SIZES =
{ sm: "text-xs", md: "text-sm" }.freeze
- BASE_CLASSES =
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground"- ACTIVE_CLASSES =
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(size: :md, is_active: false, href: nil, **options) ⇒ SidebarMenuSubButtonComponent
constructor
A new instance of SidebarMenuSubButtonComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(size: :md, is_active: false, href: nil, **options) ⇒ SidebarMenuSubButtonComponent
Returns a new instance of SidebarMenuSubButtonComponent.
14 15 16 17 18 19 |
# File 'app/components/shadcn/sidebar_menu_sub_button_component.rb', line 14 def initialize(size: :md, is_active: false, href: nil, **) super(**) @size = size.to_sym @is_active = is_active @href = href end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/components/shadcn/sidebar_menu_sub_button_component.rb', line 21 def call if @href content_tag(:a, content, .merge(href: @href)) else content_tag(:button, content, .merge(type: "button")) end end |