Skip to content

Commit

Permalink
feat: top and bottom slots for sidebar and page (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
posva authored Sep 17, 2020
1 parent 725a04c commit 1106013
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
18 changes: 16 additions & 2 deletions src/client/theme-default/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,29 @@
<ToggleSideBarButton @toggle="toggleSidebar" />
</header>
<aside :class="{ open }">
<SideBar/>
<SideBar>
<template #top>
<slot name="sidebar-top" />
</template>
<template #bottom>
<slot name="sidebar-bottom" />
</template>
</SideBar>
</aside>
<div
class="sidebar-mask"
:class="{ 'sidebar-open': open }"
@click="toggleSidebar(false)"
/>
<main>
<Page />
<Page>
<template #top>
<slot name="page-top" />
</template>
<template #bottom>
<slot name="page-bottom" />
</template>
</Page>
</main>
</div>
<Debug />
Expand Down
5 changes: 4 additions & 1 deletion src/client/theme-default/components/Page.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<template>
<div class="content">
<slot name="top" />
<Content />
<NextAndPrevLinks />
<PageEdit />
<slot name="bottom" />
</div>
</template>

<script>
import NextAndPrevLinks from './NextAndPrevLinks.vue'
import PageEdit from './PageEdit.vue'
export default {
components:{ NextAndPrevLinks, PageEdit }
components: { NextAndPrevLinks, PageEdit }
}
</script>

<style>
.content {
margin: 0 auto;
padding: 0.025rem 2.5rem 2rem;
/* if this is moved to a variable, add it to BuySellAds.vue */
max-width: 50rem;
}
Expand Down
4 changes: 4 additions & 0 deletions src/client/theme-default/components/SideBar.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<template>
<NavBarLinks class="show-mobile" />

<slot name="top" />

<ul class="sidebar">
<SideBarItem v-for="item of items" :item="item" />
</ul>

<slot name="bottom" />
</template>

<script src="./SideBar"></script>
Expand Down

0 comments on commit 1106013

Please sign in to comment.