Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support click the part outside sidebar to close the sidebar #132

Merged
merged 1 commit into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/default-theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@touchstart="onTouchStart"
@touchend="onTouchEnd">
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar"/>
<div class="sidebar-mask" @click="toggleSidebar(false)"></div>
<Sidebar :items="sidebarItems" @toggle-sidebar="toggleSidebar"/>
<div class="custom-layout" v-if="$page.frontmatter.layout">
<component :is="$page.frontmatter.layout"/>
Expand Down
24 changes: 19 additions & 5 deletions lib/default-theme/styles/theme.styl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ body
box-sizing border-box
border-bottom 1px solid $borderColor

.sidebar-mask
position fixed
z-index 9
top 0
left 0
width 100vw
height 100vh
display none

.sidebar
font-size 15px
background-color #fff
Expand Down Expand Up @@ -149,11 +158,16 @@ th, td
.custom-layout
padding-top $navbarHeight

.theme-container.no-navbar
.content:not(.custom)
h1, h2, h3, h4, h5, h6
margin-top 1.5rem
padding-top 0
.theme-container
&.sidebar-open
.sidebar-mask
display: block
&.no-navbar
.content:not(.custom)
h1, h2, h3, h4, h5, h6
margin-top 1.5rem
padding-top 0


@media (min-width: ($MQMobile + 1px))
.theme-container.no-sidebar
Expand Down