Design system.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.4 KiB

  1. import type {GetStaticProps, NextPage} from 'next';
  2. import * as fs from 'fs/promises';
  3. import * as path from 'path';
  4. import * as React from 'react'
  5. import {useRouter} from 'next/router';
  6. import ReactMarkdown from 'react-markdown';
  7. import {Layouts} from '@tesseract-design/viewfinder-react';
  8. export interface Props {
  9. markdown: string,
  10. }
  11. const IndexPage: NextPage<Props> = ({
  12. markdown,
  13. }) => {
  14. const router = useRouter();
  15. const sidebarOpen = router.query.open === 'sidebar';
  16. return (
  17. <Layouts.Basic.Root>
  18. <Layouts.Basic.ContentContainer>
  19. <ReactMarkdown
  20. className="my-12 leading-loose"
  21. components={{
  22. ul: ({node, ordered: _ordered, ...props}) => (
  23. <ul
  24. {...props}
  25. className="list-disc pl-4"
  26. />
  27. ),
  28. li: ({node, ...props}) => (
  29. <li
  30. {...props}
  31. className="list-item pl-4"
  32. />
  33. ),
  34. }}
  35. >
  36. {markdown}
  37. </ReactMarkdown>
  38. </Layouts.Basic.ContentContainer>
  39. </Layouts.Basic.Root>
  40. );
  41. }
  42. export const getStaticProps: GetStaticProps = async (ctx) => {
  43. const props = {} as Record<string, unknown>;
  44. const readmePath = path.resolve('../../README.md');
  45. props.markdown = await fs.readFile(readmePath, 'utf-8');
  46. return {
  47. props,
  48. };
  49. };
  50. export default IndexPage