Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
feat(NavigationDrawer): added option to close
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComputerM committed Sep 1, 2020
1 parent 5e4f108 commit 6c19455
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/api-generator/dist/index.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions packages/api-generator/src/NavigationDrawer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
},
"defaultValue": "256px"
},
{
"visibility": "public",
"description": null,
"keywords": [],
"name": "active",
"kind": "let",
"static": false,
"readonly": false,
"type": {
"kind": "type",
"text": "boolean",
"type": "boolean"
},
"defaultValue": true
},
{
"visibility": "public",
"description": null,
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/src/helpers/Navigation/SiteNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
</AppBar>

<NavigationDrawer
style="height:100vh;{!(navigation || sidenav) ? 'transform:translateX(-100%)' : ''}"
active={navigation || sidenav}
style="height:100vh;"
fixed
clipped>
<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
@import "./variables";

.s-navigation-drawer__border {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: $navigation-drawer-border-width;
background-color: var(--theme-dividers);
}

.s-navigation-drawer__content {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}

.s-navigation-drawer {
background-color: var(--theme-navigation-drawer);
-webkit-overflow-scrolling: touch;
Expand All @@ -17,19 +32,8 @@
will-change: transform;
transition-property: transform, visibility, width;

.s-navigation-drawer__border {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: $navigation-drawer-border-width;
background-color: var(--theme-dividers);
}

.s-navigation-drawer__content {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
&:not(.active) {
transform: translateX(-100%);
}

&.fixed {
Expand All @@ -51,6 +55,10 @@
right: initial;
}

&:not(.active) {
transform: translate(100%);
}

.s-navigation-drawer__border {
right: auto;
left: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
let klass = '';
export let width = '256px';
export let active = true;
export let fixed = false;
export let absolute = false;
export let right = false;
Expand All @@ -11,7 +12,7 @@
export let noBorder = false;
export let miniWidth = '56px';
export let clippedHeight = '56px';
export let style = '';
export let style = null;
export { klass as class };
if (mini) width = miniWidth;
Expand All @@ -23,6 +24,7 @@

<aside
class="s-navigation-drawer {klass}"
class:active
class:fixed
class:absolute
class:right
Expand Down

1 comment on commit 6c19455

@vercel
Copy link

@vercel vercel bot commented on 6c19455 Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.