Skip to content

Commit 08fbd1a

Browse files
committed
feat: add vuetoronto23 banner
1 parent 7fe90c5 commit 08fbd1a

File tree

3 files changed

+78
-17
lines changed

3 files changed

+78
-17
lines changed

.vitepress/inlined-scripts/restorePreference.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
restore('vue-docs-prefer-composition', 'prefer-composition', true)
99
restore('vue-docs-prefer-sfc', 'prefer-sfc', true)
1010

11-
// window.__VUE_BANNER_ID__ = ''
12-
// restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
11+
window.__VUE_BANNER_ID__ = 'vt2023'
12+
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
1313
})()

.vitepress/theme/components/Banner.vue

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,30 @@ function dismiss() {
2222

2323
<template>
2424
<div class="banner" v-if="open">
25-
<a target="_blank"></a>
25+
<p class="vt-banner-text">
26+
<span class="vt-text-primary">VueConf Toronto</span>
27+
<span class="vt-tagline"> - Join the premier Vue.js conference</span>
28+
| 9-10 Nov 2023 <span class="vt-place"> - Toronto, Canada</span>
29+
<a
30+
target="_blank"
31+
class="vt-primary-action"
32+
href="https://vuetoronto.com?utm_source=vuejs&utm_content=top_banner"
33+
>Register <span class="vt-time-now">Now</span></a
34+
>
35+
</p>
2636
<button @click="dismiss">
2737
<VTIconPlus class="close" />
2838
</button>
39+
<p class="vt-banner-text vt-coupon">
40+
<span class="vt-text-primary">Use code</span> VUEJS
41+
<span class="vt-text-primary">to get 15% off</span>
42+
</p>
2943
</div>
3044
</template>
3145

3246
<style>
3347
html:not(.banner-dismissed) {
34-
--vt-banner-height: 30px;
48+
--vt-banner-height: 60px;
3549
}
3650
</style>
3751

@@ -50,12 +64,10 @@ html:not(.banner-dismissed) {
5064
font-weight: 600;
5165
color: #fff;
5266
background-color: var(--vt-c-green);
53-
background: linear-gradient(
54-
90deg,
55-
rgba(66, 184, 131, 1) 0%,
56-
rgba(39, 179, 137, 1) 19%,
57-
rgba(100, 126, 255, 1) 100%
58-
);
67+
background: #11252b;
68+
display: flex;
69+
justify-content: center;
70+
align-items: center;
5971
}
6072
6173
.banner-dismissed .banner {
@@ -70,7 +82,7 @@ button {
7082
position: absolute;
7183
right: 0;
7284
top: 0;
73-
padding: 5px;
85+
padding: 20px 10px;
7486
}
7587
7688
.close {
@@ -79,10 +91,59 @@ button {
7991
fill: #fff;
8092
transform: rotate(45deg);
8193
}
82-
/*
83-
@media (max-width: 720px) {
84-
a > span {
94+
95+
.vt-banner-text {
96+
color: #fff;
97+
font-size: 16px;
98+
}
99+
100+
.vt-text-primary {
101+
color: #75c05e;
102+
}
103+
104+
.vt-primary-action {
105+
background: #75c05e;
106+
color: #121c1a;
107+
padding: 8px 15px;
108+
border-radius: 5px;
109+
font-size: 14px;
110+
text-decoration: none;
111+
margin: 0 20px;
112+
font-weight: bold;
113+
}
114+
.vt-primary-action:hover {
115+
text-decoration: none;
116+
background: #5a9f45;
117+
}
118+
119+
@media (max-width: 1280px) {
120+
.banner .vt-banner-text {
121+
font-size: 14px;
122+
}
123+
.vt-tagline {
124+
display: none;
125+
}
126+
}
127+
128+
@media (max-width: 780px) {
129+
.vt-tagline {
130+
display: none;
131+
}
132+
.vt-coupon {
133+
display: none;
134+
}
135+
.vt-primary-action {
136+
margin: 0 10px;
137+
padding: 7px 10px;
138+
}
139+
.vt-time-now {
140+
display: none;
141+
}
142+
}
143+
144+
@media (max-width: 560px) {
145+
.vt-place {
85146
display: none;
86147
}
87-
} */
148+
}
88149
</style>

.vitepress/theme/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
} from './components/preferences'
1010
import SponsorsAside from './components/SponsorsAside.vue'
1111
import VueSchoolLink from './components/VueSchoolLink.vue'
12-
// import Banner from './components/Banner.vue'
12+
import Banner from './components/Banner.vue'
1313
// import TextAd from './components/TextAd.vue'
1414

1515
export default Object.assign({}, VPTheme, {
1616
Layout: () => {
1717
// @ts-ignore
1818
return h(VPTheme.Layout, null, {
19-
// banner: () => h(Banner),
19+
banner: () => h(Banner),
2020
'sidebar-top': () => h(PreferenceSwitch),
2121
'aside-mid': () => h(SponsorsAside)
2222
})

0 commit comments

Comments
 (0)