Card.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from "react";
  2. import clsx from "clsx";
  3. import Link from "@docusaurus/Link";
  4. import styles from "../src/pages/styles.module.css";
  5. import Translate from "@docusaurus/Translate";
  6. function Card({ to, header, body, externalIcon = false }) {
  7. /*
  8. Both the `header` and `body` expect an object with the following type
  9. header = {
  10. label: String, //
  11. translateId: String //
  12. }
  13. */
  14. return (
  15. <div className={clsx("col col--4 ", styles.feature)}>
  16. <Link className="navbar__link card" to={to}>
  17. <div className="card__header">
  18. <h3>
  19. <Translate description={header.translateId}>
  20. {header.label}
  21. </Translate>
  22. {externalIcon && (
  23. <svg
  24. width="13.5"
  25. height="13.5"
  26. aria-hidden="true"
  27. viewBox="0 0 24 24"
  28. className={styles.iconExternalIcon}
  29. >
  30. <path
  31. fill="currentColor"
  32. d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"
  33. ></path>
  34. </svg>
  35. )}
  36. </h3>
  37. </div>
  38. {typeof body === "object" && (
  39. <div className="card__body">
  40. <p>
  41. <Translate description={body.translateId}>{body.label}</Translate>
  42. </p>
  43. </div>
  44. )}
  45. </Link>
  46. </div>
  47. );
  48. }
  49. export default Card;