-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1560 from hey-api/docs/announcement
docs: add announcement component
- Loading branch information
Showing
3 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<script setup> | ||
import DefaultTheme from 'vitepress/theme'; | ||
const { Layout } = DefaultTheme; | ||
</script> | ||
|
||
<template> | ||
<Layout> | ||
<template #layout-top> | ||
<div class="announcement"> | ||
<span> | ||
Request a feature<span class="hide-sm"> for your business</span> | ||
</span> | ||
<a | ||
aria-label="Send an email to Lubos" | ||
href="mailto:[email protected]?subject=Priority%20Feature%20Request" | ||
target="_blank" | ||
> | ||
Let's Talk | ||
</a> | ||
</div> | ||
</template> | ||
</Layout> | ||
</template> | ||
|
||
<style scoped> | ||
.announcement { | ||
align-items: center; | ||
background-color: var(--vp-c-bg); | ||
border-bottom: 1px solid var(--vp-c-divider); | ||
color: var(--vp-c-text-1); | ||
column-gap: 1.5rem; | ||
display: flex; | ||
font-size: var(--announcement-font-size); | ||
height: var(--announcement-height); | ||
justify-content: center; | ||
left: 0; | ||
line-height: 1; | ||
min-height: 1rem; | ||
padding-left: 1.5rem; | ||
padding-right: 1.5rem; | ||
position: fixed; | ||
top: 0; | ||
width: 100%; | ||
z-index: 31; | ||
} | ||
.announcement > a { | ||
background-color: var(--vp-button-brand-bg); | ||
border-radius: 4px; | ||
color: var(--vp-button-brand-text); | ||
font-size: 0.8em; | ||
font-weight: 600; | ||
padding: 0.4em 0.75em; | ||
} | ||
@media (width < 720px) { | ||
.hide-sm { | ||
display: none; | ||
} | ||
} | ||
@media (width >= 720px) { | ||
.show-sm { | ||
display: none; | ||
} | ||
} | ||
</style> | ||
|
||
<style> | ||
:root { | ||
--announcement-font-size: 0.875rem; | ||
--announcement-height: 2.25rem; | ||
--vp-layout-top-height: var(--announcement-height); | ||
--vp-nav-height: 48px; | ||
} | ||
@media (width < 960px) { | ||
aside.VPSidebar { | ||
top: 0 !important; | ||
} | ||
} | ||
@media (width >= 1200px) { | ||
:root { | ||
--announcement-height: 2.5rem; | ||
} | ||
} | ||
</style> |
9 changes: 8 additions & 1 deletion
9
docs/.vitepress/theme/index.js → docs/.vitepress/theme/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
// eslint-disable-next-line simple-import-sort/imports | ||
import type { Theme } from 'vitepress'; | ||
import DefaultTheme from 'vitepress/theme'; | ||
|
||
// custom CSS must be imported after default theme to correctly apply styles | ||
import './custom.css'; | ||
|
||
export default DefaultTheme; | ||
import Layout from './Layout.vue'; | ||
|
||
export default { | ||
Layout, | ||
extends: DefaultTheme, | ||
} satisfies Theme; |