Skip to content

Commit

Permalink
Feat(web): Offcanvas plugin can load breakpoint option
Browse files Browse the repository at this point in the history
refs #DS-1012
  • Loading branch information
literat committed Nov 3, 2023
1 parent 7ece66e commit 4c49c0c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/web/src/js/Offcanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const OPEN_CLASSNAME = 'is-open';
class Offcanvas extends BaseComponent {
isShown: boolean;
scrollControl: ScrollControl;
breakpoint: number;

static get NAME() {
return NAME;
Expand All @@ -30,6 +31,15 @@ class Offcanvas extends BaseComponent {

this.isShown = false;
this.scrollControl = new ScrollControl(element);
this.breakpoint = this.getBreakpoint();
}

getBreakpoint() {
return (
this.config.breakpoint ||
parseInt(getComputedStyle(document.documentElement).getPropertyValue('--spirit-breakpoint-desktop'), 10) ||
OFFCANVAS_BREAKPOINT
);
}

// Using `unknown` - Object is possibly 'null'.
Expand Down

0 comments on commit 4c49c0c

Please sign in to comment.