Skip to content

Commit 0adc42b

Browse files
authored
docs(website): add release link to homepage hero (#387)
1 parent af3cbe5 commit 0adc42b

3 files changed

Lines changed: 65 additions & 13 deletions

File tree

website/i18n.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"en": "GitHub",
1212
"zh": "GitHub"
1313
},
14+
"latestRelease": {
15+
"en": "Latest release",
16+
"zh": "最新版本"
17+
},
1418
"title": {
1519
"en": "Unified Toolchain for",
1620
"zh": "统一工具链"

website/theme/components/Hero.module.scss

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.hero {
22
--hero-title: #111214;
3-
--hero-title-muted: #747474;
4-
--hero-text: #707174;
3+
--hero-text: #848484;
54
--hero-primary-bg: #111214;
65
--hero-primary-bg-hover: #383838;
76
--hero-primary-text: #fff;
@@ -15,16 +14,15 @@
1514
align-items: center;
1615
justify-content: center;
1716
box-sizing: border-box;
18-
min-height: calc(100svh - var(--rp-nav-height));
19-
padding: clamp(3.75rem, 7.5vh, 6rem) 2rem;
17+
min-height: calc(80svh - var(--rp-nav-height));
18+
padding: clamp(3.75rem, 7.5vh, 6rem) 2rem 0;
2019
overflow: hidden;
2120
background: var(--rp-c-bg);
2221
}
2322

2423
:global(.dark) .hero {
2524
--hero-title: #f5f5f5;
26-
--hero-title-muted: #9a9a9a;
27-
--hero-text: #a1a3a6;
25+
--hero-text: #9a9a9a;
2826
--hero-primary-bg: #f2f2f2;
2927
--hero-primary-bg-hover: #fff;
3028
--hero-primary-text: #111214;
@@ -44,6 +42,33 @@
4442
transform: translateY(-1.5rem);
4543
}
4644

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

6186
.subtitle {
62-
color: var(--hero-title-muted);
87+
color: var(--hero-text);
6388
}
6489

6590
.description {
6691
max-width: 42rem;
6792
margin: clamp(2.5rem, 5vh, 3.75rem) 0 0;
6893
color: var(--hero-text);
69-
font-size: clamp(1rem, 2vw, 1.25rem);
94+
font-size: clamp(1rem, 2vw, 1.2rem);
7095
font-weight: 400;
71-
line-height: 1.5;
96+
line-height: 1.6;
7297
letter-spacing: -0.02em;
7398
text-wrap: balance;
7499
}
@@ -125,15 +150,15 @@
125150

126151
&:hover {
127152
color: var(--hero-secondary-text);
128-
border-color: var(--hero-title-muted);
153+
border-color: var(--hero-text);
129154
background: var(--hero-secondary-bg-hover);
130155
}
131156
}
132157

133158
@media (max-width: 640px) {
134159
.hero {
135-
min-height: calc(100svh - var(--rp-nav-height));
136-
padding: 3.25rem 1.25rem;
160+
min-height: calc(80svh - var(--rp-nav-height));
161+
padding: 3.25rem 1.25rem 0;
137162
}
138163

139164
.title {
@@ -142,6 +167,11 @@
142167
letter-spacing: -0.055em;
143168
}
144169

170+
.releaseLink {
171+
margin-bottom: 1.5rem;
172+
font-size: 0.8125rem;
173+
}
174+
145175
.description {
146176
max-width: 30rem;
147177
margin-top: 2rem;
@@ -162,7 +192,8 @@
162192
}
163193

164194
@media (prefers-reduced-motion: reduce) {
165-
.link {
195+
.link,
196+
.releaseLink {
166197
transition: none;
167198
}
168199
}

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({ label }: { label: string }) {
11+
return (
12+
<a
13+
className={styles.releaseLink}
14+
href={releasesUrl}
15+
target="_blank"
16+
rel="noopener noreferrer"
17+
>
18+
{label} 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 label={t('latestRelease')} />
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)