Skip to content

Commit 9ea20dc

Browse files
jay-esIsraelOrtuno
andauthored
feat(*): add madvue banner (#3154) (#2485)
Co-authored-by: Israel Ortuño <[email protected]>
1 parent 6778cce commit 9ea20dc

File tree

3 files changed

+86
-18
lines changed

3 files changed

+86
-18
lines changed

Diff for: .vitepress/inlined-scripts/restorePreference.js

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

Diff for: .vitepress/theme/components/Banner.vue

+82-14
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,32 @@ 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">
27+
<span style="color:#f97844">Mad</span>
28+
<span>Vue</span>
29+
</span>
30+
<span class="vt-tagline"> · The Vue.js Event in Madrid</span>
31+
<span class="vt-place"> · Spain</span>
32+
<span class="vt-date"> · 29 May 2025</span>
33+
<a target="_blank" class="vt-primary-action"
34+
href="https://madvue.es/?utm_source=vuejs&utm_content=top_banner">
35+
Register
36+
</a>
37+
</p>
2638
<button @click="dismiss">
2739
<VTIconPlus class="close" />
2840
</button>
41+
<p class="vt-banner-text vt-coupon">
42+
<span class="vt-text-primary">Early bird</span> tickets available
43+
<span class="vt-text-primary">Get 30% off</span>
44+
</p>
2945
</div>
3046
</template>
3147

3248
<style>
3349
html:not(.banner-dismissed) {
34-
--vt-banner-height: 30px;
50+
--vt-banner-height: 60px;
3551
}
3652
</style>
3753

@@ -50,12 +66,10 @@ html:not(.banner-dismissed) {
5066
font-weight: 600;
5167
color: #fff;
5268
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-
);
69+
background: #0f172a;
70+
display: flex;
71+
justify-content: center;
72+
align-items: center;
5973
}
6074
6175
.banner-dismissed .banner {
@@ -70,7 +84,7 @@ button {
7084
position: absolute;
7185
right: 0;
7286
top: 0;
73-
padding: 5px;
87+
padding: 20px 10px;
7488
}
7589
7690
.close {
@@ -79,10 +93,64 @@ button {
7993
fill: #fff;
8094
transform: rotate(45deg);
8195
}
82-
/*
83-
@media (max-width: 720px) {
84-
a > span {
96+
97+
.vt-banner-text {
98+
color: #fff;
99+
font-size: 16px;
100+
}
101+
102+
.vt-text-primary {
103+
color: #c4d141;
104+
}
105+
106+
.vt-primary-action {
107+
background: #f97844;
108+
color: #fff;
109+
padding: 6px 12px;
110+
border-radius: 5px;
111+
font-size: 14px;
112+
text-decoration: none;
113+
margin: 0 20px;
114+
font-weight: bold;
115+
}
116+
117+
.vt-primary-action:hover {
118+
text-decoration: none;
119+
background: #c4d141;
120+
}
121+
122+
@media (max-width: 1280px) {
123+
.banner .vt-banner-text {
124+
font-size: 14px;
125+
}
126+
127+
.vt-tagline {
85128
display: none;
86129
}
87-
} */
88-
</style>
130+
}
131+
132+
@media (max-width: 780px) {
133+
.vt-tagline {
134+
display: none;
135+
}
136+
137+
.vt-coupon {
138+
display: none;
139+
}
140+
141+
.vt-primary-action {
142+
margin: 0 10px;
143+
padding: 5px 8px;
144+
}
145+
146+
.vt-time-now {
147+
display: none;
148+
}
149+
}
150+
151+
@media (max-width: 560px) {
152+
.vt-place {
153+
display: none;
154+
}
155+
}
156+
</style>

Diff for: .vitepress/theme/index.ts

+2-2
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)