Skip to content

docs: add vueschool banner #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 47 additions & 19 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
<template>
<ParentLayout>
<template #page-top-ads><span /></template>
<template #page-top>
<CarbonAds
v-if="$site.themeConfig.carbonAds"
:key="'carbon' + $page.relativePath"
:code="$site.themeConfig.carbonAds.carbon"
:placement="$site.themeConfig.carbonAds.placement"
/>
</template>
<template #page-bottom>
<BuySellAds
v-if="$site.themeConfig.carbonAds"
:key="'custom' + $page.relativePath"
:code="$site.themeConfig.carbonAds.custom"
:placement="$site.themeConfig.carbonAds.placement"
/>
</template>
</ParentLayout>
<div
class="theme-container"
:class="{ 'has-top-banner': showTopBanner }"
>
<BannerTop
v-if="showTopBanner"
@close="closeBannerTop"
/>
<ParentLayout>
<template #page-top-ads><span /></template>
<template #page-top>
<CarbonAds
v-if="$site.themeConfig.carbonAds"
:key="'carbon' + $page.relativePath"
:code="$site.themeConfig.carbonAds.carbon"
:placement="$site.themeConfig.carbonAds.placement"
/>
</template>
<template #page-bottom>
<BuySellAds
v-if="$site.themeConfig.carbonAds"
:key="'custom' + $page.relativePath"
:code="$site.themeConfig.carbonAds.custom"
:placement="$site.themeConfig.carbonAds.placement"
/>
</template>
</ParentLayout>
</div>
</template>

<script>
import DefaultTheme from 'vitepress/dist/client/theme-default'
import CarbonAds from './components/CarbonAds.vue'
import BuySellAds from './components/BuySellAds.vue'
import BannerTop from './components/BannerTop.vue'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for future banners: I think this should be async


export default {
name: 'Layout',
Expand All @@ -32,7 +42,25 @@ export default {
ParentLayout: DefaultTheme.Layout,
CarbonAds,
BuySellAds,
BannerTop
},

data () {
return {
showTopBanner: false
}
},

mounted () {
this.showTopBanner = !localStorage.getItem('VS_OFFER_BANNER_CLOSED')
},

methods: {
closeBannerTop () {
this.showTopBanner = false
localStorage.setItem('VS_OFFER_BANNER_CLOSED', 1)
}
}
}
</script>

Expand Down
245 changes: 245 additions & 0 deletions docs/.vitepress/theme/components/BannerTop.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<template>
<a id="vs" href="https://vueschool.io/the-vuejs-master-class/?friend=vuerouter#plans" target="_blank" rel="noreferrer">
<div class="vs-iso">
<img src="/images/vueschool/vs-iso.svg" alt="Vue School Logo">
</div>
<div class="vs-logo">
<img src="/images/vueschool/vs-logo.svg" alt="Vue School Logo">
</div>
<div class="vs-core">
<div class="vs-slogan">
<div class="vs-slogan-up">
LEARN VUE AT VUE SCHOOL
</div>
<div class="vs-slogan-down">
Register today and get <strong>20% OFF</strong>
</div>
</div>
<div class="vs-button">
<div class="vs-button-inside">
<img src="/images/vueschool/learn-more.svg" alt="Learn More">
</div>
</div>
</div>
<div
id="vs-close"
class="vs-close"
@click.stop.prevent="$emit('close')">
<img src="/images/vueschool/close.svg" alt="Close">
</div>
</a>
</template>

<style>
#vs {
align-items: center;
background-color: #1e204d;
background-position: top right;
background-repeat: no-repeat;
background-size: cover;
box-sizing: border-box;
color: #fff;
font-family: 'Roboto', Oxygen, Fira Sans, Helvetica Neue, sans-serif;
justify-content: center;
position: fixed;
padding: 0 10px;
left: 0;
right: 0;
top: 0;
z-index: 100;
background-image: url("/images/vueschool/vs-banner-bg-mobile-2.svg");
height: 3.125rem;
display: flex;
}

#vs:hover {
text-decoration: none;
}

@media (min-width: 680px) {
#vs {
height: 5rem;
background-image: url("/images/vueschool/vs-banner-bg-tablet-2.svg");
}
}

@media (min-width: 900px) {
#vs {
background-image: url("/images/vueschool/vs-banner-bg-desktop-2.svg");
}
}

#vs:hover .vs-core .vs-button .vs-button-inside {
background: linear-gradient(#ed81eb, #d457d0);
}

#vs .vs-iso {
position: absolute;
left: 20px;
height: 26px;
}

#vs .vs-iso img {
height: 26px;
}

@media (min-width: 680px) {
#vs .vs-iso {
left: 40px;
height: 40px;
}

#vs .vs-iso img {
height: 40px;
}
}

@media (min-width: 900px) {
#vs .vs-iso {
display: none;
}
}

#vs .vs-logo {
position: absolute;
display: none;
left: 40px;
}

@media (min-width: 900px) {
#vs .vs-logo {
display: block;
}
}

#vs .vs-core {
display: flex;
align-items: center;
}

#vs .vs-core .vs-slogan {
text-align: center;
}

#vs .vs-core .vs-slogan .vs-slogan-up {
color: #47b785;
font-size: 14px;
font-weight: bold;
}

@media (min-width: 680px) {
#vs .vs-core .vs-slogan .vs-slogan-up {
font-size: 18px;
}
}

#vs .vs-core .vs-slogan .vs-slogan-down {
color: #fff;
font-size: 12px;
padding-top: 2px;
}

@media (min-width: 680px) {
#vs .vs-core .vs-slogan .vs-slogan-down {
font-size: 16px;
}
}

#vs .vs-core .vs-slogan .vs-slogan-down strong {
color: #fff;
font-weight: bold;
}

#vs .vs-core .vs-button {
margin-left: 43px;
color: #fff;
background: linear-gradient(to bottom, #b349b0, #dc61da);
padding: 2px;
border-radius: 40px;
display: none;
}

@media (min-width: 680px) {
#vs .vs-core .vs-button {
display: inline-block;
}
}

#vs .vs-core .vs-button .vs-button-inside {
border-radius: 40px;
background: linear-gradient(#dc61da, #b349b0);
transition: all 0.25s ease-in;
padding: 12px 24px 8px;
line-height: 0;
}

@media (min-width: 680px) {
#vs .vs-core .vs-button .vs-button-inside {
padding: 12px 24px 8px;
}
}

#vs .vs-core .vs-button.vs-button-alt {
background: linear-gradient(to bottom, #ffcc38, #ffd13d);
}

#vs .vs-core .vs-button.vs-button-alt .vs-button-inside {
background: linear-gradient(to bottom, #ffe24f, #ffa40e);
}

#vs .vs-close {
right: 10px;
position: absolute;
padding: 10px;
}

@media (min-width: 680px) {
#vs .vs-close {
right: 20px;
}
}

#vs .vs-close:hover {
color: #56d8ff;
}

/************************************/

.theme-container.has-top-banner #vs {
display: flex;
}

.theme-container.has-top-banner {
margin-top: 3.125rem;
}

.theme-container.has-top-banner .nav-bar {
margin-top: 3.125rem;
}

.theme-container.has-top-banner .sidebar {
margin-top: 3.125rem;
}

.theme-container.has-top-banner .page {
margin-top: 3.125rem;
}

@media (min-width: 680px) {
.theme-container.has-top-banner {
margin-top: 5rem;
}

.theme-container.has-top-banner .nav-bar {
margin-top: 5rem;
}

.theme-container.has-top-banner .sidebar {
margin-top: 5rem;
}

.theme-container.has-top-banner .page {
margin-top: 5rem;
}
}
</style>
7 changes: 7 additions & 0 deletions docs/public/images/vueschool/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/public/images/vueschool/learn-more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading