|
1 | 1 | import clsx from "clsx";
|
2 | 2 | import { useCallback, useState } from "react";
|
3 | 3 | import SyntaxHighlighter from "react-syntax-highlighter";
|
4 |
| -import { useTheme } from "./hooks"; |
5 | 4 | import {
|
6 | 5 | oneLight,
|
7 | 6 | vscDarkPlus,
|
8 | 7 | } from "react-syntax-highlighter/dist/esm/styles/prism";
|
| 8 | +import { useTheme } from "./hooks"; |
9 | 9 |
|
10 | 10 | export interface HeadingProps extends React.ComponentProps<"h1"> {
|
11 | 11 | level: 1 | 2 | 3 | 4 | 5 | 6;
|
@@ -51,19 +51,20 @@ export function CodeBlock({
|
51 | 51 | <div
|
52 | 52 | className={clsx(
|
53 | 53 | "w-full overflow-x-auto rounded-lg",
|
54 |
| - "bg-gray-50 dark:bg-gray-800" |
| 54 | + "bg-gray-50 dark:bg-gray-800", |
55 | 55 | )}
|
56 | 56 | >
|
57 | 57 | <div className="inline-flex w-full justify-between bg-gray-100 p-2">
|
58 | 58 | <div className="px-2 py-1 text-xs text-gray-900 dark:text-gray-400">
|
59 | 59 | {match[1]}
|
60 | 60 | </div>
|
61 |
| - <div |
| 61 | + <button |
| 62 | + type="button" |
62 | 63 | className="px-2 py-1 text-xs text-gray-900 dark:text-gray-400 cursor-pointer"
|
63 | 64 | onClick={handleCopy}
|
64 | 65 | >
|
65 | 66 | {copied ? "Copied" : "Copy"}
|
66 |
| - </div> |
| 67 | + </button> |
67 | 68 | </div>
|
68 | 69 | <SyntaxHighlighter
|
69 | 70 | {...rest}
|
@@ -92,7 +93,7 @@ export function CodeBlock({
|
92 | 93 | {...rest}
|
93 | 94 | className={clsx(
|
94 | 95 | "rounded-md px-1 py-0.5 text-[85%]",
|
95 |
| - "bg-gray-100 dark:bg-gray-800" |
| 96 | + "bg-gray-100 dark:bg-gray-800", |
96 | 97 | )}
|
97 | 98 | >
|
98 | 99 | {children}
|
@@ -120,7 +121,7 @@ export function Link({ children, className, ...rest }: LinkProps) {
|
120 | 121 | <a
|
121 | 122 | className={clsx(
|
122 | 123 | "text-blue-600 dark:text-blue-400 hover:underline underline-offset-1",
|
123 |
| - className |
| 124 | + className, |
124 | 125 | )}
|
125 | 126 | target="_blank"
|
126 | 127 | {...rest}
|
|
0 commit comments