Module: UI::DrawerTitleBehavior

Included in:
DrawerTitle, DrawerTitleComponent
Defined in:
app/behaviors/ui/drawer_title_behavior.rb

Overview

Shared behavior for Drawer Title component ARIA-compliant heading for drawer

Instance Method Summary collapse

Instance Method Details

#drawer_title_base_classesObject

Base CSS classes for drawer title



9
10
11
# File 'app/behaviors/ui/drawer_title_behavior.rb', line 9

def drawer_title_base_classes
  "text-foreground font-semibold"
end

#drawer_title_classesObject

Merge base classes with custom classes using TailwindMerge



14
15
16
# File 'app/behaviors/ui/drawer_title_behavior.rb', line 14

def drawer_title_classes
  TailwindMerge::Merger.new.merge([drawer_title_base_classes, @classes].compact.join(" "))
end

#drawer_title_html_attributesObject

Build complete HTML attributes hash for title



19
20
21
22
23
24
25
# File 'app/behaviors/ui/drawer_title_behavior.rb', line 19

def drawer_title_html_attributes
  base_attrs = @attributes || {}
  base_attrs.merge(
    class: drawer_title_classes,
    role: "heading"
  )
end