|
| 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 | +} |
0 commit comments