Training.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import theme from "../../styles/theme";
  2. import TrainingBlock from "./TrainingBlock";
  3. import Link from "next/link";
  4. import { ITraining } from "../types";
  5. import TrainingMeta from "./TrainingMeta";
  6. const Training = ({ training }: { training: ITraining }) => {
  7. return (
  8. <article>
  9. <h2>{training.title}</h2>
  10. <TrainingMeta training={training} />
  11. <section>
  12. <h2>Program</h2>
  13. <Link href="/timer">
  14. <button>Start Timer</button>
  15. </Link>
  16. {training.blocks &&
  17. training.blocks
  18. .sort(block => block.sequence || 0)
  19. .map(block => <TrainingBlock key={block.id} block={block} />)}
  20. </section>
  21. <style jsx>
  22. {`
  23. article {
  24. display: grid;
  25. grid-template-areas:
  26. "title title"
  27. "information placeholder"
  28. "content content";
  29. grid-template-columns: 1fr 2fr;
  30. background-image: url("media/man_working_out.jpg");
  31. background-size: auto 400px;
  32. background-repeat: no-repeat;
  33. margin: 2em 0;
  34. }
  35. article > * {
  36. padding: 0.2em 1em;
  37. margin: 0;
  38. }
  39. article > h2 {
  40. grid-area: title;
  41. font-weight: 900;
  42. font-size: 120%;
  43. background: ${theme.colors.darkerblue};
  44. color: ${theme.colors.offWhite};
  45. }
  46. section {
  47. grid-area: content;
  48. padding: 1em 2em;
  49. }
  50. span.caption {
  51. }
  52. button {
  53. border: none;
  54. background: ${theme.colors.darkblue};
  55. color: ${theme.colors.offWhite};
  56. font-weight: 900;
  57. padding: 0.5rem;
  58. cursor: pointer;
  59. }
  60. `}
  61. </style>
  62. </article>
  63. );
  64. };
  65. export default Training;