Skip to content

Commit a861f93

Browse files
committed
feat(website): add release link to homepage hero
1 parent af3cbe5 commit a861f93

2 files changed

Lines changed: 55 additions & 5 deletions

File tree

website/theme/components/Hero.module.scss

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
align-items: center;
1616
justify-content: center;
1717
box-sizing: border-box;
18-
min-height: calc(100svh - var(--rp-nav-height));
19-
padding: clamp(3.75rem, 7.5vh, 6rem) 2rem;
18+
min-height: calc(80svh - var(--rp-nav-height));
19+
padding: clamp(3.75rem, 7.5vh, 6rem) 2rem 0;
2020
overflow: hidden;
2121
background: var(--rp-c-bg);
2222
}
@@ -44,6 +44,33 @@
4444
transform: translateY(-1.5rem);
4545
}
4646

47+
.releaseLink {
48+
display: inline-flex;
49+
align-items: center;
50+
margin-bottom: clamp(1.5rem, 3vh, 2.5rem);
51+
color: var(--hero-text);
52+
font-size: 0.875rem;
53+
font-weight: 400;
54+
line-height: 1.5;
55+
text-decoration-line: underline;
56+
text-decoration-color: transparent;
57+
text-decoration-thickness: 1px;
58+
text-underline-offset: 0.25em;
59+
transition:
60+
color 0.2s ease,
61+
text-decoration-color 0.2s ease;
62+
63+
&:hover {
64+
color: var(--hero-title);
65+
text-decoration-color: currentcolor;
66+
}
67+
68+
&:focus-visible {
69+
outline: 2px solid var(--rp-c-brand);
70+
outline-offset: 3px;
71+
}
72+
}
73+
4774
.title {
4875
margin: 0;
4976
color: var(--hero-title);
@@ -132,8 +159,8 @@
132159

133160
@media (max-width: 640px) {
134161
.hero {
135-
min-height: calc(100svh - var(--rp-nav-height));
136-
padding: 3.25rem 1.25rem;
162+
min-height: calc(80svh - var(--rp-nav-height));
163+
padding: 3.25rem 1.25rem 0;
137164
}
138165

139166
.title {
@@ -142,6 +169,11 @@
142169
letter-spacing: -0.055em;
143170
}
144171

172+
.releaseLink {
173+
margin-bottom: 1.5rem;
174+
font-size: 0.8125rem;
175+
}
176+
145177
.description {
146178
max-width: 30rem;
147179
margin-top: 2rem;
@@ -162,7 +194,8 @@
162194
}
163195

164196
@media (prefers-reduced-motion: reduce) {
165-
.link {
197+
.link,
198+
.releaseLink {
166199
transition: none;
167200
}
168201
}

website/theme/components/Hero.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import { useI18n } from '@rspress/core/runtime';
22
import { Link } from '@rspress/core/theme-original';
3+
import rstackPackage from 'rstack/package.json';
34
import { useI18nUrl } from './utils';
45
import styles from './Hero.module.scss';
56

67
const githubUrl = 'https://github.com/rstackjs/rstack-cli';
8+
const releasesUrl = `${githubUrl}/releases`;
9+
10+
function ReleaseLink() {
11+
return (
12+
<a
13+
className={styles.releaseLink}
14+
href={releasesUrl}
15+
target="_blank"
16+
rel="noopener noreferrer"
17+
>
18+
Latest release v{rstackPackage.version}
19+
</a>
20+
);
21+
}
722

823
export function Hero() {
924
const tUrl = useI18nUrl();
@@ -12,6 +27,8 @@ export function Hero() {
1227
return (
1328
<section className={styles.hero} aria-labelledby="home-hero-title">
1429
<div className={styles.inner}>
30+
<ReleaseLink />
31+
1532
<h1 id="home-hero-title" className={styles.title}>
1633
<span>{t('title')}</span>
1734
<span className={styles.subtitle}>{t('subtitle')}</span>

0 commit comments

Comments
 (0)