Skip to content

Commit 6d4e543

Browse files
authored
feat(*): add vuetoronto banner (#2992)
1 parent 7f55589 commit 6d4e543

File tree

3 files changed

+79
-17
lines changed

3 files changed

+79
-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__ = 'vt2024_1'
12+
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
1313
})()

.vitepress/theme/components/Banner.vue

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,31 @@ 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+
| 18-20 Nov 2024 <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+
>
34+
Register
35+
</a>
36+
</p>
2637
<button @click="dismiss">
2738
<VTIconPlus class="close" />
2839
</button>
40+
<p class="vt-banner-text vt-coupon">
41+
<span class="vt-text-primary">Use code</span> VUEJS
42+
<span class="vt-text-primary">to get 15% off</span>
43+
</p>
2944
</div>
3045
</template>
3146

3247
<style>
3348
html:not(.banner-dismissed) {
34-
--vt-banner-height: 30px;
49+
--vt-banner-height: 60px;
3550
}
3651
</style>
3752

@@ -50,12 +65,10 @@ html:not(.banner-dismissed) {
5065
font-weight: 600;
5166
color: #fff;
5267
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-
);
68+
background: #11252b;
69+
display: flex;
70+
justify-content: center;
71+
align-items: center;
5972
}
6073
6174
.banner-dismissed .banner {
@@ -70,7 +83,7 @@ button {
7083
position: absolute;
7184
right: 0;
7285
top: 0;
73-
padding: 5px;
86+
padding: 20px 10px;
7487
}
7588
7689
.close {
@@ -79,10 +92,59 @@ button {
7992
fill: #fff;
8093
transform: rotate(45deg);
8194
}
82-
/*
83-
@media (max-width: 720px) {
84-
a > span {
95+
96+
.vt-banner-text {
97+
color: #fff;
98+
font-size: 16px;
99+
}
100+
101+
.vt-text-primary {
102+
color: #75c05e;
103+
}
104+
105+
.vt-primary-action {
106+
background: #75c05e;
107+
color: #121c1a;
108+
padding: 8px 15px;
109+
border-radius: 5px;
110+
font-size: 14px;
111+
text-decoration: none;
112+
margin: 0 20px;
113+
font-weight: bold;
114+
}
115+
.vt-primary-action:hover {
116+
text-decoration: none;
117+
background: #5a9f45;
118+
}
119+
120+
@media (max-width: 1280px) {
121+
.banner .vt-banner-text {
122+
font-size: 14px;
123+
}
124+
.vt-tagline {
125+
display: none;
126+
}
127+
}
128+
129+
@media (max-width: 780px) {
130+
.vt-tagline {
131+
display: none;
132+
}
133+
.vt-coupon {
134+
display: none;
135+
}
136+
.vt-primary-action {
137+
margin: 0 10px;
138+
padding: 7px 10px;
139+
}
140+
.vt-time-now {
141+
display: none;
142+
}
143+
}
144+
145+
@media (max-width: 560px) {
146+
.vt-place {
85147
display: none;
86148
}
87-
} */
149+
}
88150
</style>

.vitepress/theme/index.ts

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

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

0 commit comments

Comments
 (0)