Skip to content

Commit 69fb6f8

Browse files
author
Eric Lin
committed
feat: add quick links instead of default
1 parent 2487006 commit 69fb6f8

File tree

2 files changed

+104
-2
lines changed

2 files changed

+104
-2
lines changed
+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import React from "react";
2+
import clsx from "clsx";
3+
import Link from "@docusaurus/Link";
4+
// import styles from "./styles.module.css";
5+
6+
type CardItem = {
7+
title: string;
8+
link: string;
9+
description: JSX.Element;
10+
buttonName: string;
11+
buttonType:
12+
| "primary"
13+
| "secondary"
14+
| "success"
15+
| "info"
16+
| "warning"
17+
| "danger"
18+
| "link";
19+
};
20+
21+
const CardList: CardItem[] = [
22+
{
23+
title: "🏁 Getting Started",
24+
link: "/docs/getting-started",
25+
description: (
26+
<>
27+
Come check out the fastest way to get started with this template repo!
28+
</>
29+
),
30+
buttonName: "Create new docs!",
31+
buttonType: "success",
32+
},
33+
{
34+
title: "💭 Repo Layout",
35+
link: "/docs/getting-started/understanding-repo-layout",
36+
description: (
37+
<>
38+
See how this repo is laid out to understand what each file and folder is
39+
responsible for.
40+
</>
41+
),
42+
buttonName: "Go to repo layout",
43+
buttonType: "secondary",
44+
},
45+
{
46+
title: "👨‍💻 Documentation style guide",
47+
link: "/docs/getting-started/style-guide",
48+
description: (
49+
<>
50+
Find our standard documentation style guide to follow when applying to
51+
your docs repo.
52+
</>
53+
),
54+
buttonName: "Go to reference",
55+
buttonType: "info",
56+
},
57+
];
58+
59+
function Card({ title, link, description, buttonName, buttonType }: CardItem) {
60+
return (
61+
<div className={clsx("col", "col--4", "margin-top--md")}>
62+
<div className="card-demo">
63+
<div className="card">
64+
<div className="card__header">
65+
<h3>{title}</h3>
66+
</div>
67+
<div className="card__body">
68+
<p>{description}</p>
69+
</div>
70+
<div className="card__footer">
71+
<Link
72+
className={clsx(
73+
"button",
74+
"button--" + buttonType,
75+
"button--block",
76+
)}
77+
to={link}>
78+
{buttonName}
79+
</Link>
80+
</div>
81+
</div>
82+
</div>
83+
</div>
84+
);
85+
}
86+
87+
export default function HomepageCards(): JSX.Element {
88+
return (
89+
<section className={clsx("margin-top--lg", "margin-bottom--lg")}>
90+
<div className="container">
91+
<h1>Quick Links</h1>
92+
<hr />
93+
<div className="row">
94+
{CardList.map((props, idx) => (
95+
<Card key={idx} {...props} />
96+
))}
97+
</div>
98+
</div>
99+
</section>
100+
);
101+
}

src/pages/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import clsx from "clsx";
33
import Link from "@docusaurus/Link";
44
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
55
import Layout from "@theme/Layout";
6-
import HomepageFeatures from "@site/src/components/HomepageFeatures";
6+
import HomepageCards from "@site/src/components/HomepageCards";
77

88
import styles from "./index.module.css";
99

@@ -34,7 +34,8 @@ export default function Home(): JSX.Element {
3434
description="Description will go into a meta tag in <head />">
3535
<HomepageHeader />
3636
<main>
37-
<HomepageFeatures />
37+
<HomepageCards />
38+
{/* <HomepageFeatures /> */}
3839
</main>
3940
</Layout>
4041
);

0 commit comments

Comments
 (0)