Skip to content

Commit d050704

Browse files
feature (#170): add temporary beta banner (#175)
* feature (#170): add temporary beta banner * feature (#170): improve phrasing Co-authored-by: Natalia Tepluhina <tarya.se@gmail.com> * fix (#170): update home page with beta banner * docs (#170): improve phrasing Co-authored-by: Natalia Tepluhina <tarya.se@gmail.com>
1 parent fcb40f3 commit d050704

File tree

7 files changed

+61
-47
lines changed

7 files changed

+61
-47
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script>
2+
export default {}
3+
</script>
4+
5+
<template>
6+
<aside class="beta-banner">
7+
<p>
8+
⚠️ Beta Version: Docs are still under development and are subject to
9+
change. ⚠️
10+
</p>
11+
</aside>
12+
</template>
13+
14+
<style></style>

src/.vuepress/styles/index.styl

+15
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,21 @@
125125
}
126126
}
127127

128+
.beta-banner
129+
position fixed
130+
z-index 20
131+
top $navbarHeight
132+
left 0
133+
right 0
134+
height 3rem
135+
display flex
136+
align-items center
137+
justify-content center
138+
background-color #fffedb
139+
box-sizing border-box
140+
border-bottom 1px solid $borderColor
141+
font-weight bold
142+
128143
.scrimba,
129144
.vueschool {
130145
background-color: #e7ecf3;

src/.vuepress/theme/components/Home.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export default {
144144
@import '@theme/styles/_settings.scss';
145145
146146
.hero {
147-
padding: 100px 40px 30px;
147+
padding: calc(100px + 3rem) 40px 30px; // add $betaBannerHeight
148148
149149
.inner {
150150
max-width: 1260px;

src/.vuepress/theme/components/Sidebar.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
<slot name="top" />
66

7-
<SidebarLinks
8-
:depth="0"
9-
:items="items"
10-
/>
7+
<SidebarLinks :depth="0" :items="items" />
118
<slot name="bottom" />
129
</aside>
1310
</template>
@@ -45,7 +42,7 @@ export default {
4542
font-size 1.1em
4643
padding 0.5rem 0 0.5rem 1.5rem
4744
& > .sidebar-links
48-
padding 1.5rem 0
45+
padding calc(1.5rem + 3rem) 0 // add $betaBannerHeight
4946
& > li > a.sidebar-link
5047
font-size 1.1em
5148
line-height 1.7

src/.vuepress/theme/layouts/Layout.vue

+25-38
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,12 @@
55
@touchstart="onTouchStart"
66
@touchend="onTouchEnd"
77
>
8-
<Navbar
9-
v-if="shouldShowNavbar"
10-
@toggle-sidebar="toggleSidebar"
11-
/>
12-
13-
<div
14-
class="sidebar-mask"
15-
@click="toggleSidebar(false)"
16-
/>
17-
18-
<Sidebar
19-
:items="sidebarItems"
20-
@toggle-sidebar="toggleSidebar"
21-
>
8+
<BetaBanner />
9+
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar" />
10+
11+
<div class="sidebar-mask" @click="toggleSidebar(false)" />
12+
13+
<Sidebar :items="sidebarItems" @toggle-sidebar="toggleSidebar">
2214
<template #top>
2315
<slot name="sidebar-top" />
2416
</template>
@@ -29,10 +21,7 @@
2921

3022
<Home v-if="$page.frontmatter.home" />
3123

32-
<Page
33-
v-else
34-
:sidebar-items="sidebarItems"
35-
>
24+
<Page v-else :sidebar-items="sidebarItems">
3625
<template #top>
3726
<slot name="page-top" />
3827
</template>
@@ -60,40 +49,38 @@ export default {
6049
Navbar
6150
},
6251
63-
data () {
52+
data() {
6453
return {
6554
isSidebarOpen: false
6655
}
6756
},
6857
6958
computed: {
70-
shouldShowNavbar () {
59+
shouldShowNavbar() {
7160
const { themeConfig } = this.$site
7261
const { frontmatter } = this.$page
73-
if (
74-
frontmatter.navbar === false
75-
|| themeConfig.navbar === false) {
62+
if (frontmatter.navbar === false || themeConfig.navbar === false) {
7663
return false
7764
}
7865
return (
79-
this.$title
80-
|| themeConfig.logo
81-
|| themeConfig.repo
82-
|| themeConfig.nav
83-
|| this.$themeLocaleConfig.nav
66+
this.$title ||
67+
themeConfig.logo ||
68+
themeConfig.repo ||
69+
themeConfig.nav ||
70+
this.$themeLocaleConfig.nav
8471
)
8572
},
8673
87-
shouldShowSidebar () {
74+
shouldShowSidebar() {
8875
const { frontmatter } = this.$page
8976
return (
90-
!frontmatter.home
91-
&& frontmatter.sidebar !== false
92-
&& this.sidebarItems.length
77+
!frontmatter.home &&
78+
frontmatter.sidebar !== false &&
79+
this.sidebarItems.length
9380
)
9481
},
9582
96-
sidebarItems () {
83+
sidebarItems() {
9784
return resolveSidebarItems(
9885
this.$page,
9986
this.$page.regularPath,
@@ -102,7 +89,7 @@ export default {
10289
)
10390
},
10491
105-
pageClasses () {
92+
pageClasses() {
10693
const userPageClass = this.$page.frontmatter.pageClass
10794
return [
10895
{
@@ -115,27 +102,27 @@ export default {
115102
}
116103
},
117104
118-
mounted () {
105+
mounted() {
119106
this.$router.afterEach(() => {
120107
this.isSidebarOpen = false
121108
})
122109
},
123110
124111
methods: {
125-
toggleSidebar (to) {
112+
toggleSidebar(to) {
126113
this.isSidebarOpen = typeof to === 'boolean' ? to : !this.isSidebarOpen
127114
this.$emit('toggle-sidebar', this.isSidebarOpen)
128115
},
129116
130117
// side swipe
131-
onTouchStart (e) {
118+
onTouchStart(e) {
132119
this.touchStart = {
133120
x: e.changedTouches[0].clientX,
134121
y: e.changedTouches[0].clientY
135122
}
136123
},
137124
138-
onTouchEnd (e) {
125+
onTouchEnd(e) {
139126
const dx = e.changedTouches[0].clientX - this.touchStart.x
140127
const dy = e.changedTouches[0].clientY - this.touchStart.y
141128
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 40) {
+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
$contentClass = '.theme-default-content'
22
$fontPrimary = 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif
3+
$betaBannerHeight = 3rem
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
$wrapper
22
max-width $contentWidth
33
margin 0 auto
4-
padding 2rem 2.5rem
4+
padding calc(2rem + 3rem) 2.5rem // added $betaBannerHeight
55
@media (max-width: $MQNarrow)
6-
padding 2rem
6+
padding calc(2rem + 3rem) 2rem // added $betaBannerHeight
77
@media (max-width: $MQMobileNarrow)
8-
padding 1.5rem
8+
padding calc(2rem + 3rem) 1.5rem // added $betaBannerHeight
99

0 commit comments

Comments
 (0)