diff --git a/src/_pages/Solutions.tsx b/src/_pages/Solutions.tsx index 019bf6f..ac71900 100644 --- a/src/_pages/Solutions.tsx +++ b/src/_pages/Solutions.tsx @@ -48,41 +48,60 @@ const SolutionSection = ({ content: React.ReactNode isLoading: boolean currentLanguage: string -}) => ( -
-

- {title} -

- {isLoading ? ( -
-
-

- Loading solutions... -

+}) => { + const [copied, setCopied] = useState(false) + + const copyToClipboard = () => { + if (typeof content === "string") { + navigator.clipboard.writeText(content).then(() => { + setCopied(true) + setTimeout(() => setCopied(false), 2000) + }) + } + } + + return ( +
+

+ {title} +

+ {isLoading ? ( +
+
+

+ Loading solutions... +

+
-
- ) : ( -
- - {content as string} - -
- )} -
-) + ) : ( +
+ + + {content as string} + +
+ )} +
+ ) +} export const ComplexitySection = ({ timeComplexity,