From 4bd92e20f5dcabc3c006391154693d5daaffd60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Israel=20Ortu=C3=B1o?= Date: Tue, 21 Jan 2025 00:32:01 +0100 Subject: [PATCH] feat(*): add madvue banner --- .../inlined-scripts/restorePreference.js | 4 +- .vitepress/theme/components/Banner.vue | 96 ++++++++++++++++--- .vitepress/theme/index.ts | 4 +- 3 files changed, 86 insertions(+), 18 deletions(-) diff --git a/.vitepress/inlined-scripts/restorePreference.js b/.vitepress/inlined-scripts/restorePreference.js index 5e18b50ffa..e75c6ef22e 100644 --- a/.vitepress/inlined-scripts/restorePreference.js +++ b/.vitepress/inlined-scripts/restorePreference.js @@ -8,6 +8,6 @@ restore('vue-docs-prefer-composition', 'prefer-composition', true) restore('vue-docs-prefer-sfc', 'prefer-sfc', true) - // window.__VUE_BANNER_ID__ = '' - // restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed') + window.__VUE_BANNER_ID__ = 'madvue2025_1' + restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed') })() diff --git a/.vitepress/theme/components/Banner.vue b/.vitepress/theme/components/Banner.vue index 6730fcd48d..a61d1a992f 100644 --- a/.vitepress/theme/components/Banner.vue +++ b/.vitepress/theme/components/Banner.vue @@ -22,16 +22,32 @@ function dismiss() { @@ -50,12 +66,10 @@ html:not(.banner-dismissed) { font-weight: 600; color: #fff; background-color: var(--vt-c-green); - background: linear-gradient( - 90deg, - rgba(66, 184, 131, 1) 0%, - rgba(39, 179, 137, 1) 19%, - rgba(100, 126, 255, 1) 100% - ); + background: #0f172a; + display: flex; + justify-content: center; + align-items: center; } .banner-dismissed .banner { @@ -70,7 +84,7 @@ button { position: absolute; right: 0; top: 0; - padding: 5px; + padding: 20px 10px; } .close { @@ -79,10 +93,64 @@ button { fill: #fff; transform: rotate(45deg); } -/* -@media (max-width: 720px) { - a > span { + +.vt-banner-text { + color: #fff; + font-size: 16px; +} + +.vt-text-primary { + color: #c4d141; +} + +.vt-primary-action { + background: #f97844; + color: #fff; + padding: 6px 12px; + border-radius: 5px; + font-size: 14px; + text-decoration: none; + margin: 0 20px; + font-weight: bold; +} + +.vt-primary-action:hover { + text-decoration: none; + background: #c4d141; +} + +@media (max-width: 1280px) { + .banner .vt-banner-text { + font-size: 14px; + } + + .vt-tagline { display: none; } -} */ - +} + +@media (max-width: 780px) { + .vt-tagline { + display: none; + } + + .vt-coupon { + display: none; + } + + .vt-primary-action { + margin: 0 10px; + padding: 5px 8px; + } + + .vt-time-now { + display: none; + } +} + +@media (max-width: 560px) { + .vt-place { + display: none; + } +} + \ No newline at end of file diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 3aa1dac274..9ea1fb93ff 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -10,14 +10,14 @@ import { } from './components/preferences' import SponsorsAside from './components/SponsorsAside.vue' import VueSchoolLink from './components/VueSchoolLink.vue' -// import Banner from './components/Banner.vue' +import Banner from './components/Banner.vue' // import TextAd from './components/TextAd.vue' export default Object.assign({}, VPTheme, { Layout: () => { // @ts-ignore return h(VPTheme.Layout, null, { - // banner: () => h(Banner), + banner: () => h(Banner), 'sidebar-top': () => h(PreferenceSwitch), 'sidebar-bottom': () => h(SecurityUpdateBtn), 'aside-mid': () => h(SponsorsAside)