Skip to content

Commit ef2374c

Browse files
authored
feat(website): add user testimonials (#895)
1 parent bcc32ca commit ef2374c

File tree

4 files changed

+82
-1
lines changed

4 files changed

+82
-1
lines changed

website/src/components/HomepageFeatures/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.features {
22
display: flex;
33
align-items: center;
4-
padding: 2rem 0;
4+
padding-top: 2rem;
55
width: 100%;
66
}
77

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from "react";
2+
import styles from "./styles.module.css";
3+
4+
const testimonials = [
5+
{
6+
name: "Boshen",
7+
handle: "boshen",
8+
date: "Sep 29, 2024",
9+
content:
10+
"git-cliff is amazing. I managed to use its published crates for my project's release management.",
11+
url: "https://x.com/boshen_c/status/1840391571495420362",
12+
},
13+
];
14+
15+
const getRandomTestimonial = () => {
16+
const randomIndex = Math.floor(Math.random() * testimonials.length);
17+
return testimonials[randomIndex];
18+
};
19+
20+
export default function Testimonials(): JSX.Element {
21+
const review = getRandomTestimonial();
22+
23+
return (
24+
<div className={styles.testimonialsList}>
25+
<div className={styles.testimonial}>
26+
<p className={styles.content}>
27+
<em>"{review.content}"</em>
28+
</p>
29+
<div className={styles.details}>
30+
<span className={styles.author}>
31+
- {review.name} (
32+
<a
33+
href={`https://github.com/${review.handle}`}
34+
target="_blank"
35+
rel="noopener noreferrer"
36+
>{`@${review.handle}`}</a>
37+
)
38+
</span>
39+
<a
40+
href={review.url}
41+
target="_blank"
42+
rel="noopener noreferrer"
43+
className={styles.date}
44+
>
45+
{review.date}
46+
</a>
47+
</div>
48+
</div>
49+
</div>
50+
);
51+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.testimonialsList {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 0.5rem;
5+
margin: 1rem auto;
6+
max-width: 500px;
7+
padding: 0 1rem;
8+
}
9+
10+
.testimonial {
11+
font-size: 0.9rem;
12+
line-height: 1.4;
13+
padding: 0.5rem 0;
14+
text-align: center;
15+
}
16+
17+
.content {
18+
margin: 0;
19+
font-style: italic;
20+
}
21+
22+
.details {
23+
display: flex;
24+
flex-direction: column;
25+
align-items: flex-end;
26+
font-size: 0.8rem;
27+
margin-top: 0.3rem;
28+
}

website/src/pages/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Link from "@docusaurus/Link";
44
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
55
import Layout from "@theme/Layout";
66
import HomepageFeatures from "@site/src/components/HomepageFeatures";
7+
import Testimonials from "@site/src/components/Testimonials";
78
import Head from "@docusaurus/Head";
89
import styles from "./index.module.css";
910

@@ -70,6 +71,7 @@ export default function Home(): JSX.Element {
7071
<HomepageHeader />
7172
<main>
7273
<HomepageFeatures />
74+
<Testimonials />
7375
</main>
7476
</Layout>
7577
);

0 commit comments

Comments
 (0)