File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
assets/stylesheets/components Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 22 position : sticky;
33 top : calc (var (--nav-height ) + var (--spacing-5 ));
44 align-self : start;
5+ max-height : calc (100vh - var (--nav-height ) - var (--spacing-5 ));
6+ overflow-y : auto;
7+ padding-right : var (--spacing-2 );
58}
69
710.sidebar-section {
Original file line number Diff line number Diff line change 1+ import { Controller } from "@hotwired/stimulus"
2+
3+ export default class extends Controller {
4+ static targets = [ "button" , "menu" ]
5+
6+ connect ( ) {
7+ this . close ( )
8+ }
9+
10+ toggle ( ) {
11+ if ( document . body . classList . contains ( "nav-open" ) ) {
12+ this . close ( )
13+ } else {
14+ this . open ( )
15+ }
16+ }
17+
18+ open ( ) {
19+ document . body . classList . add ( "nav-open" )
20+ if ( this . hasButtonTarget ) {
21+ this . buttonTarget . setAttribute ( "aria-expanded" , "true" )
22+ }
23+ }
24+
25+ close ( ) {
26+ document . body . classList . remove ( "nav-open" , "sidebar-open" )
27+ if ( this . hasButtonTarget ) {
28+ this . buttonTarget . setAttribute ( "aria-expanded" , "false" )
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments