Design system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

72 rivejä
1.8 KiB

  1. import {Refractor} from '@modal-sh/react-refractor';
  2. import {NextPage} from 'next';
  3. import * as React from 'react';
  4. import {getFormValues} from '@theoryofnekomata/formxtra';
  5. const BlogPostPage: NextPage = () => {
  6. const handleAction: React.FormEventHandler<HTMLFormElement> = React.useCallback((e) => {
  7. e.preventDefault();
  8. const { currentTarget, nativeEvent } = e;
  9. const { submitter } = nativeEvent as unknown as { submitter: HTMLButtonElement };
  10. const { action } = getFormValues(currentTarget, { submitter });
  11. switch (action) {
  12. case 'copyContents':
  13. console.log('copy contents');
  14. break;
  15. default:
  16. break;
  17. }
  18. }, []);
  19. return (
  20. <>
  21. <div className="container mx-auto px-4">
  22. <h1>
  23. Using Refractor on your Next website
  24. </h1>
  25. <p>
  26. Use <code>@modal-sh/react-refractor</code> as follows on your page:
  27. </p>
  28. </div>
  29. <div className="bg-shade/20 overflow-auto pt-4 pb-8 text-sm">
  30. <div className="container mx-auto px-4">
  31. <Refractor
  32. lineNumbers
  33. header
  34. language="tsx"
  35. scroll
  36. actions={
  37. <></>
  38. }
  39. code={`import {Refractor} from '@modal-sh/react-refractor';
  40. import {NextPage} from 'next';
  41. const BlogPostPage: NextPage = () => {
  42. return (
  43. <div className="container mx-auto px-4">
  44. <Refractor
  45. language="tsx"
  46. code={\`
  47. import {Refractor} from '@modal-sh/react-refractor';
  48. \`}
  49. />
  50. </div>
  51. );
  52. };
  53. export default BlogPostPage;
  54. `}
  55. />
  56. </div>
  57. </div>
  58. <div className="container mx-auto px-4">
  59. <p>
  60. Easy as that!
  61. </p>
  62. </div>
  63. </>
  64. )
  65. };
  66. export default BlogPostPage;