diff --git a/website/.vitepress/components/HeroActions.vue b/website/.vitepress/components/HeroActions.vue new file mode 100644 index 00000000..02ca51d5 --- /dev/null +++ b/website/.vitepress/components/HeroActions.vue @@ -0,0 +1,32 @@ + + + diff --git a/website/.vitepress/theme/custom.css b/website/.vitepress/theme/custom.css index 79590773..57017abf 100644 --- a/website/.vitepress/theme/custom.css +++ b/website/.vitepress/theme/custom.css @@ -169,6 +169,36 @@ html:not(.dark) .vp-sponsor-grid-item .logo-dark { display: block; } +/* Mirrors the .actions/.action rules of VitePress' VPHero.vue, which are scoped + to that component and so do not reach the row in HeroActions.vue. */ +.hero-actions { + display: flex; + flex-wrap: wrap; + margin: -6px; + padding-top: 24px; +} + +.hero-action { + flex-shrink: 0; + padding: 6px; +} + +.VPHero.has-image .hero-actions { + justify-content: center; +} + +@media (min-width: 640px) { + .hero-actions { + padding-top: 32px; + } +} + +@media (min-width: 960px) { + .VPHero.has-image .hero-actions { + justify-content: flex-start; + } +} + @media (max-width: 639px) { .VPHomeHero { overflow: hidden; @@ -189,13 +219,13 @@ html:not(.dark) .vp-sponsor-grid-item .logo-dark { line-height: 36px; } - .VPHomeHero .actions { + .VPHomeHero .hero-actions { align-items: stretch; margin-right: 0; margin-left: 0; } - .VPHomeHero .action { + .VPHomeHero .hero-action { min-width: min(100%, 15rem); } diff --git a/website/.vitepress/theme/index.ts b/website/.vitepress/theme/index.ts index 495bf7dc..9670930b 100644 --- a/website/.vitepress/theme/index.ts +++ b/website/.vitepress/theme/index.ts @@ -2,6 +2,7 @@ import DefaultTheme from 'vitepress/theme'; import type { Theme } from 'vitepress'; import './custom.css'; import HomePage from '../components/HomePage.vue'; +import HeroActions from '../components/HeroActions.vue'; import AuthorCard from '../components/AuthorCard.vue'; import BlogPost from '../components/BlogPost.vue'; import Version from '../components/Version.vue'; @@ -15,6 +16,7 @@ export default { extends: DefaultTheme, Layout() { return h(DefaultTheme.Layout, null, { + 'home-hero-actions-after': () => h(HeroActions), 'home-features-after': () => h(HomePage) }); }, @@ -23,7 +25,10 @@ export default { app.component('BlogPost', BlogPost); app.component('Version', Version); app.component('Adopters', Adopters); - app.component('CopyOrDownloadAsMarkdownButtons', CopyOrDownloadAsMarkdownButtons); + app.component( + 'CopyOrDownloadAsMarkdownButtons', + CopyOrDownloadAsMarkdownButtons + ); enhanceAppWithTabs(app); } } satisfies Theme; diff --git a/website/src/index.md b/website/src/index.md index 491beb2b..70a900e5 100644 --- a/website/src/index.md +++ b/website/src/index.md @@ -5,6 +5,8 @@ description: YAML Taskfile. layout: home titleTemplate: false +# The hero buttons live in .vitepress/components/HeroActions.vue, which +# renders them next to the GitHub star count. hero: name: Task text: The Modern Task Runner @@ -14,13 +16,6 @@ hero: image: src: /img/logo.svg alt: Task logo - actions: - - theme: brand - text: Get Started - link: /docs/getting-started - - theme: alt - text: Browse the Reference - link: /docs/reference/schema features: - title: Readable by design