1
1
<script setup>
2
- import { computed } from ' vue'
2
+ import { ref } from ' vue'
3
3
4
4
/**
5
5
* Adding a new banner:
@@ -10,72 +10,13 @@ import { computed } from 'vue'
10
10
11
11
let open = $ref (true )
12
12
13
- const items = [
14
- {
15
- banner: {
16
- assets: " FREE_WEEKEND" ,
17
- cta: " JOIN FOR FREE" ,
18
- link: " /free-weekend" ,
19
- static: " FREE_WEEKEND" ,
20
- subtitle: " Get Access to ALL Vue School premium courses" ,
21
- title: " Free Weekend 1st & 2nd of October"
22
- },
23
- ends: " 2022-09-30T23:59:59+02:00" ,
24
- id: " FREE_WEEKEND_LOBBY" ,
25
- isExtended: false
26
- },
27
- {
28
- banner: {
29
- assets: " FREE_WEEKEND" ,
30
- cta: " WATCH FOR FREE" ,
31
- link: " /free-weekend" ,
32
- static: " FREE_WEEKEND_LIVE" ,
33
- subtitle: " Get Access to ALL Vue School premium courses" ,
34
- title: " Free Weekend <strong>NOW LIVE</strong>"
35
- },
36
- ends: " 2022-10-02T23:59:59+02:00" ,
37
- id: " FREE_WEEKEND_LIVE" ,
38
- isExtended: false
39
- },
40
- {
41
- banner: {
42
- assets: " LEVELUP2022" ,
43
- cta: " GET OFFER" ,
44
- link: " /sales/levelup2022" ,
45
- static: " LEVELUP2022" ,
46
- subtitle: " Access 800+ lessons including the Vue.js 3 Masterclass" ,
47
- title: " Less than <strong>_HOURS_ hours</strong> to get 45% off at Vue School"
48
- },
49
- ends: " 2022-10-04T23:59:59+02:00" ,
50
- id: " LEVELUP2022" ,
51
- isExtended: false
52
- },
53
- {
54
- banner: {
55
- assets: " LEVELUP2022" ,
56
- cta: " GET OFFER" ,
57
- link: " /sales/levelup2022" ,
58
- static: " LEVELUP2022" ,
59
- subtitle: " Extended! Access 800+ lessons including the Vue.js 3 Masterclass" ,
60
- title: " Less than <strong>_HOURS_ hours</strong> to get 45% off at Vue School"
61
- },
62
- ends: " 2022-10-06T23:59:59+02:00" ,
63
- id: " LEVELUP2022_EXTENDED" ,
64
- isExtended: true
65
- }
66
- ]
67
-
68
- const now = new Date ()
69
- const phases = computed (() => items .map (phase => ({ ... phase, remaining: new Date (phase .ends ) - now })))
70
- const activePhase = computed (() => phases .value .find (phase => phase .remaining > 0 ))
71
- const title = computed (() => {
72
- if (! activePhase .value ) return null
73
- const hours = Math .ceil (activePhase .value .remaining / 1000 / 60 / 60 )
74
- return activePhase .value .banner .title .replace (' _HOURS_' , hours)
75
- })
76
- const activeBanner = computed (() => {
77
- if (! activePhase .value ) return null
78
- return activePhase .value .banner
13
+ const banner = ref ({
14
+ assets: " LEVELUP2022" ,
15
+ cta: " GET OFFER" ,
16
+ link: " /sales/levelup2022" ,
17
+ static: " LEVELUP2022" ,
18
+ subtitle: " Access 800+ lessons including the Vue.js 3 Masterclass" ,
19
+ title: " Less than <strong>48 hours</strong> to get 45% off at Vue School"
79
20
})
80
21
81
22
/**
@@ -89,22 +30,22 @@ function dismiss() {
89
30
</script >
90
31
91
32
<template >
92
- <div class =" banner" v-if =" open && activeBanner " >
33
+ <div class =" banner" v-if =" open" >
93
34
<a
94
35
id =" vs-top"
95
- :href =" `https://vueschool.io${activeBanner .link}?friend=vuejs&utm_source=vuejs&utm_medium=website&utm_campaign=affiliate&utm_content=top_banner`"
36
+ :href =" `https://vueschool.io${banner .link}?friend=vuejs&utm_source=vuejs&utm_medium=website&utm_campaign=affiliate&utm_content=top_banner`"
96
37
target =" _blank"
97
- :class =" activeBanner .assets" >
38
+ :class =" banner .assets" >
98
39
<div class =" vs-background-wrapper" >
99
40
<div class =" vs-logo" />
100
41
<div class =" vs-core" >
101
42
<div class =" vs-slogan-wrapper" >
102
- <div class =" vs-slogan" v-html =" title" />
103
- <div class =" vs-subline" v-html =" activeBanner .subtitle" />
43
+ <div class =" vs-slogan" v-html =" banner. title" />
44
+ <div class =" vs-subline" v-html =" banner .subtitle" />
104
45
</div >
105
46
<div class =" vs-button-wrapper" >
106
47
<div class =" vs-button" >
107
- {{ activeBanner .cta }}
48
+ {{ banner .cta }}
108
49
</div >
109
50
</div >
110
51
</div >
@@ -260,54 +201,6 @@ html:not(.banner-dismissed) {
260
201
}
261
202
}
262
203
263
- /* FREE_WEEKEND
264
- ******************************************/
265
-
266
- #vs-top .FREE_WEEKEND {
267
- color : #FFF ;
268
- background : linear-gradient (to left , #161a35 , #283065 );
269
- }
270
-
271
- #vs-top .FREE_WEEKEND .vs-logo {
272
- background-image : url (https://vueschool.io/images/mark-vueschool-white.svg );
273
- }
274
-
275
- #vs-top .FREE_WEEKEND .vs-core .vs-slogan {
276
- color : #fff ;
277
- }
278
-
279
- #vs-top .FREE_WEEKEND .vs-core .vs-slogan strong {
280
- color : #ff2556 ;
281
- }
282
-
283
- #vs-top .FREE_WEEKEND .vs-core .vs-subline {
284
- color : #c6cdf7 ;
285
- }
286
-
287
- #vs-top .FREE_WEEKEND .vs-background-wrapper {
288
- background-image : url (https://vueschool.io/images/banners/assets/FREE_WEEKEND/bg-mobile.png );
289
- background-repeat : no-repeat ;
290
- background-size : cover ;
291
- background-position : top right ;
292
- }
293
-
294
- @media (min-width : 680px ) {
295
- #vs-top .FREE_WEEKEND .vs-background-wrapper {
296
- background-image : url (https://vueschool.io/images/banners/assets/FREE_WEEKEND/bg-tablet.svg );
297
- }
298
- }
299
-
300
- @media (min-width : 1280px ) {
301
- #vs-top .FREE_WEEKEND .vs-logo {
302
- background-image : url (https://vueschool.io/images/icons/logo-white.svg );
303
- }
304
-
305
- #vs-top .FREE_WEEKEND .vs-background-wrapper {
306
- background-image : url (https://vueschool.io/images/banners/assets/FREE_WEEKEND/bg-desktop.svg );
307
- background-position : top right -60px ;
308
- }
309
- }
310
-
311
204
/* LEVELUP2022
312
205
******************************************/
313
206
0 commit comments