Skip to content

Commit 3ab1e5e

Browse files
authored
docs: add vuejsde conf banner may (#2208)
1 parent 39e6f5e commit 3ab1e5e

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<template>
2+
<div class="banner banner-vuejsconf" v-if="isVisible">
3+
<a href="https://conf.vuejs.de/?utm_source=vuejs&utm_medium=referral&utm_campaign=banner-placement&utm_content=banner"
4+
target="_blank">
5+
<picture>
6+
<source media="(min-width:1200px)" srcset="/vuejsde-conf/vuejsdeconf_banner_large.png" />
7+
<source media="(min-width:920px)" srcset="/vuejsde-conf/vuejsdeconf_banner_medium.png" />
8+
<img src="/vuejsde-conf/vuejsdeconf_banner_small.png" alt="" />
9+
</picture>
10+
</a>
11+
<div class="close-btn" @click.stop.prevent="closeBanner">
12+
<span class="close">&times;</span>
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script setup lang="ts">
18+
import { ref, onMounted } from 'vue'
19+
20+
const isVisible = ref(false)
21+
22+
const nameStorage = 'VUEJSDECONF-BANNER-MAY-2024'
23+
24+
const resetLayoutTopHeight = () => {
25+
document.documentElement.classList.add('banner-dismissed')
26+
}
27+
28+
const closeBanner = () => {
29+
// Hide the banner
30+
isVisible.value = false
31+
// Save action in the local storage
32+
localStorage.setItem(nameStorage, String(true))
33+
resetLayoutTopHeight()
34+
}
35+
36+
onMounted(() => {
37+
isVisible.value = !localStorage.getItem(nameStorage)
38+
39+
if (!isVisible.value) {
40+
resetLayoutTopHeight()
41+
}
42+
})
43+
</script>
44+
<style>
45+
html:not(.banner-dismissed) {
46+
--vp-layout-top-height: 60px;
47+
}
48+
</style>
49+
<style scoped>
50+
.banner {
51+
position: fixed;
52+
z-index: var(--vp-z-index-layout-top);
53+
box-sizing: border-box;
54+
top: 0;
55+
left: 0;
56+
right: 0;
57+
height: var(--vp-layout-top-height);
58+
line-height: 0;
59+
text-align: center;
60+
font-size: 12px;
61+
font-weight: 600;
62+
color: #fff;
63+
}
64+
65+
.banner-dismissed .banner {
66+
display: none;
67+
}
68+
69+
a {
70+
text-decoration: underline;
71+
}
72+
73+
.banner-vuejsconf {
74+
background: linear-gradient(90deg, #fff 50%, #43b883 50%);
75+
}
76+
77+
.banner-vuejsconf a {
78+
display: inline-block;
79+
margin: 0 auto;
80+
}
81+
82+
.banner-vuejsconf .close-btn {
83+
top: 10px;
84+
right: 10px;
85+
z-index: 99;
86+
position: absolute;
87+
border-radius: 50%;
88+
padding: 10px;
89+
cursor: pointer;
90+
}
91+
</style>

packages/docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import './styles/vars.css'
88
import './styles/sponsors.css'
99
import VueSchoolLink from './components/VueSchoolLink.vue'
1010
import VueMasteryLogoLink from './components/VueMasteryLogoLink.vue'
11+
import VuejsdeConfBanner from './components/VuejsdeConfBanner.vue'
1112
import status from '../translation-status.json'
1213

1314
const i18nLabels = {
@@ -21,6 +22,7 @@ const theme: Theme = {
2122
// 'home-features-after': () => h(HomeSponsors),
2223
'aside-ads-before': () => h(AsideSponsors),
2324
'doc-before': () => h(TranslationStatus, { status, i18nLabels }),
25+
'layout-top': () => h(VuejsdeConfBanner)
2426
})
2527
},
2628

11.7 KB
Loading
8.02 KB
Loading
3.17 KB
Loading

0 commit comments

Comments
 (0)