Skip to content

Commit 44b9095

Browse files
authored
Add Vue School Black Friday 21 banners (#1330)
* Add Vue School Black Friday 21 banners * Update Black Friday Vue School banner
1 parent c90a0a2 commit 44b9095

File tree

12 files changed

+417
-86
lines changed

12 files changed

+417
-86
lines changed

src/.vuepress/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ module.exports = {
274274
'link',
275275
{
276276
href:
277-
'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
277+
'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Archivo:400,600|Open+Sans:400,600;display=swap',
278278
rel: 'stylesheet'
279279
}
280280
],
@@ -510,7 +510,7 @@ module.exports = {
510510
custom: 'CKYD62QM',
511511
placement: 'vuejsorg'
512512
},
513-
topBanner: false
513+
topBanner: true
514514
},
515515
plugins: [
516516
[
Loading
Loading
Loading
Loading
Loading

src/.vuepress/public/images/vueschool/vueschool_blackfriday_background_tablet.svg

Lines changed: 200 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<template>
2+
<div
3+
class="vs-blackfriday-coins">
4+
<img
5+
v-for="coin in coins"
6+
:key="coin.id"
7+
:alt="coin.id"
8+
:src="`/images/vueschool/tech-coin-${coin.id}.png`"
9+
:class="[coin.id, coin.inverse ? inverseDirection : direction]"
10+
:style="coin.style"
11+
class="vs-blackfriday-coin">
12+
</div>
13+
</template>
14+
15+
<script>
16+
const coins = [
17+
{ id: 'js', inverse: true },
18+
{ id: 'ts' },
19+
{ id: 'vue', inverse: true },
20+
{ id: 'vuex', inverse: true },
21+
{ id: 'nuxt' }
22+
]
23+
24+
export default {
25+
data () {
26+
return {
27+
coins,
28+
xPosition: 0,
29+
direction: 'left',
30+
inverseDirection: 'right',
31+
isAnimated: false
32+
}
33+
},
34+
mounted () {
35+
if (window.innerWidth < 1024) return
36+
this.isAnimated = true
37+
this.animationTarget = document.getElementById('vs')
38+
this.animationTarget.addEventListener('mousemove', this.animate)
39+
},
40+
beforeDestroy () {
41+
if (!this.isAnimated) return
42+
this.animationTarget.removeEventListener('mousemove', this.animate)
43+
},
44+
methods: {
45+
animate (e) {
46+
this.direction = e.pageX > this.xPosition ? 'right' : 'left'
47+
this.inverseDirection = this.direction === 'left' ? 'right' : 'left'
48+
this.xPosition = e.pageX
49+
}
50+
}
51+
}
52+
</script>
53+
54+
<style>
55+
.vs-blackfriday-coins {
56+
overflow: hidden;
57+
position: absolute;
58+
bottom: 0;
59+
right: 0;
60+
top: 0;
61+
left: 0;
62+
z-index: -1;
63+
}
64+
65+
.vs-blackfriday-coin {
66+
display: none;
67+
}
68+
69+
@media (min-width: 768px) {
70+
.vs-blackfriday-coins {
71+
background-image: url(/images/vueschool/vueschool_blackfriday_background_tablet.svg);
72+
background-position: center;
73+
background-size: cover;
74+
}
75+
}
76+
77+
@media (min-width: 1024px) {
78+
.vs-blackfriday-coins {
79+
background: transparent;
80+
}
81+
82+
#vs:hover .vs-blackfriday-coin.left {
83+
transform: translateX(-600px);
84+
transition: transform 30s linear;
85+
}
86+
87+
#vs:hover .vs-blackfriday-coin.right {
88+
transform: translateX(600px);
89+
transition: transform 30s linear;
90+
}
91+
92+
.vs-blackfriday-coin {
93+
display: inline-block;
94+
position: absolute;
95+
transition: transform 1000ms linear;
96+
transform: translateX(0);
97+
}
98+
99+
.vs-blackfriday-coin.js {
100+
width: 43px;
101+
top: 32px;
102+
left: calc(50% - 341px);
103+
}
104+
105+
.vs-blackfriday-coin.ts {
106+
top: 0;
107+
left: 0;
108+
width: 54px;
109+
left: calc(50% + 457px);
110+
}
111+
112+
.vs-blackfriday-coin.vue {
113+
top: 18px;
114+
width: 60px;
115+
left: calc(50% + 586px);
116+
}
117+
118+
.vs-blackfriday-coin.vuex {
119+
top: 23px;
120+
left: 0;
121+
width: 56px;
122+
left: calc(50% - 620px);
123+
}
124+
125+
.vs-blackfriday-coin.nuxt {
126+
top: 10px;
127+
width: 48px;
128+
left: calc(50% - 474px);
129+
}
130+
}
131+
</style>

src/.vuepress/theme/components/BannerTop.vue

Lines changed: 64 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
11
<template>
2-
<a id="vs" href="https://vueschool.io/sales/summer-vue?friend=vuejs" target="_blank" rel="noreferrer">
3-
<div class="vs-iso">
4-
<img src="/images/vueschool/vs-iso.svg">
5-
</div>
6-
<div class="vs-logo">
7-
<img src="/images/vueschool/vs-logo.svg">
8-
</div>
2+
<a id="vs" class="vs-hidden" href="https://vueschool.io/sales/blackfriday?friend=vuejs" target="_blank" rel="noreferrer">
3+
<BannerCoins />
94
<div class="vs-core">
10-
<div class="vs-backpack">
11-
<img src="/images/vueschool/vs-backpack.png" alt="Backpack">
5+
<div class="vs-logo">
6+
<img src="/images/vueschool/vueschool_blackfriday_logo.svg">
127
</div>
138
<div class="vs-slogan">
14-
Extended! <span class="vs-slogan-light">Last few hours</span> for the Vue School offer
9+
<div class="vs-slogan-subtitle">
10+
Access to all Vue Courses at Vue School
11+
</div>
12+
<div class="vs-slogan-title">
13+
Black Friday <strong>40% OFF</strong>
14+
</div>
1515
</div>
1616
<div class="vs-button">
17-
GET ACCESS
17+
Get Discount
1818
</div>
1919
</div>
20-
<div
21-
id="vs-close"
22-
class="vs-close"
23-
@click.stop.prevent="$emit('close')">
24-
<img src="/images/vueschool/close.svg" alt="Close">
20+
<div id="vs-close" class="vs-close">
21+
<img src="/images/vueschool/vueschool_close.svg" alt="Close">
2522
</div>
2623
</a>
2724
</template>
2825

26+
<script>
27+
import BannerCoins from './BannerCoins.vue'
28+
29+
export default {
30+
components: {
31+
BannerCoins
32+
}
33+
}
34+
</script>
35+
2936
<style lang="stylus">
3037
@require '../styles/config'
3138
$topBannerHeight ?= 5rem
32-
$topBannerHeightMobile ?= 3.125rem
39+
$topBannerHeightMobile ?= 5rem
3340
3441
// Banner
3542
#vs
3643
align-items: center
37-
background-color: #202A5A
44+
background-color: #000c19
3845
box-sizing: border-box
3946
color: #fff
4047
display: none
@@ -46,91 +53,65 @@ $topBannerHeightMobile ?= 3.125rem
4653
right: 0
4754
top: 0
4855
z-index: 100
56+
line-height: 1
4957
height: $topBannerHeightMobile
5058
@media (min-width: 680px)
5159
height: $topBannerHeight
60+
justify-content: center
61+
5262
&:hover
5363
.vs-core
5464
.vs-button
55-
background: #f22606
56-
57-
.vs-iso
58-
display: none
59-
position: absolute
60-
left: 20px
61-
height: 26px
62-
img
63-
height: 26px
64-
@media (min-width: 680px)
65-
display: inline-block
66-
height: 40px
67-
img
68-
height: 40px
69-
@media (min-width: 900px)
70-
display: none
71-
72-
.vs-logo
73-
position: absolute
74-
display: none
75-
left: 20px
76-
@media (min-width: 900px)
77-
display: block
65+
background: linear-gradient(261deg, #e61463 100%, #db5248 3%)
7866
7967
.vs-core
8068
display: flex
8169
align-items: center
8270
83-
.vs-backpack
84-
margin-right: 6px
85-
position: absolute
86-
@media (min-width: 680px)
87-
position: static
88-
margin-right: 4px
89-
img
90-
height: 50px
91-
@media (min-width: 680px)
92-
height: 56px
93-
@media (min-width: 900px)
94-
height: 74px
95-
9671
.vs-slogan
72+
font-family: Archivo
9773
color: #FFF
98-
font-weight: bold
99-
font-size: 14px
100-
text-align: center
101-
padding: 0 90px
74+
margin-left: 8px
10275
@media (min-width: 680px)
103-
padding: 0
104-
text-align: left
105-
margin-right: 26px
106-
margin-right: 0
107-
font-size: 18px
108-
> .vs-slogan-light
109-
color: #ff5338
110-
text-align: left
111-
@media (min-width: 900px)
112-
text-align: center
113-
display: inline
76+
margin-left: 24px
77+
.vs-slogan-subtitle
78+
font-size: 12px
79+
@media (min-width: 680px)
80+
font-size: 14px
81+
.vs-slogan-title
82+
margin-top: 6px
83+
font-size: 16px
84+
font-weight: 600
85+
@media (min-width: 680px)
86+
font-size: 18px
87+
strong
88+
color: #ffae29
89+
font-weight: 600
11490
11591
.vs-button
116-
margin-left: 13px
11792
color: #FFF
118-
padding: 13px 24px
119-
border-radius: 40px
120-
display: none
121-
background: #ff5338
122-
font-weight: bold
93+
padding: 7px 10px
94+
border-radius: 4px
95+
background: linear-gradient(to left, #e61b60, #dd4a4c)
96+
font-weight: 600
97+
white-space: nowrap
98+
margin-right: 30px
99+
margin-left: 1px
123100
@media (min-width: 680px)
124-
display: inline-block
101+
margin-right: 0
102+
padding: 8px 24px
103+
margin-left: 32px
104+
@media (min-width: 680px)
105+
margin-left: 69px
125106
126107
.vs-close
127-
right: 10px
128-
position: absolute
129-
padding: 10px
130-
@media (min-width: 680px)
131-
right: 20px
132-
&:hover
133-
color: #56D8FF
108+
right: 6px
109+
position: absolute
110+
@media (min-width: 680px)
111+
padding: 10px
112+
right: 20px
113+
&:hover
114+
color: #56D8FF
134115
135116
/************************************/
136117

src/.vuepress/theme/layouts/Layout.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,15 @@ export default {
132132
this.isSidebarOpen = false
133133
})
134134
135-
this.showTopBanner = false
135+
this.showTopBanner = !localStorage.getItem('VS_BF21_BANNER_CLOSED')
136136
},
137137
138138
methods: {
139+
closeBannerTop () {
140+
this.showTopBanner = false
141+
localStorage.setItem('VS_BF21_BANNER_CLOSED', 1)
142+
},
143+
139144
toggleSidebar(to) {
140145
this.isSidebarOpen = typeof to === 'boolean' ? to : !this.isSidebarOpen
141146
this.$emit('toggle-sidebar', this.isSidebarOpen)

0 commit comments

Comments
 (0)