@ -48,41 +48,60 @@ const SolutionSection = ({
content : React.ReactNode
isLoading : boolean
currentLanguage : string
} ) = > (
< div className = "space-y-2" >
< h2 className = "text-[13px] font-medium text-white tracking-wide" >
{ title }
< / h2 >
{ isLoading ? (
< div className = "space-y-1.5" >
< div className = "mt-4 flex" >
< p className = "text-xs bg-gradient-to-r from-gray-300 via-gray-100 to-gray-300 bg-clip-text text-transparent animate-pulse" >
Loading solutions . . .
< / p >
} ) = > {
const [ copied , setCopied ] = useState ( false )
const copyToClipboard = ( ) = > {
if ( typeof content === "string" ) {
navigator . clipboard . writeText ( content ) . then ( ( ) = > {
setCopied ( true )
setTimeout ( ( ) = > setCopied ( false ) , 2000 )
} )
}
}
return (
< div className = "space-y-2 relative" >
< h2 className = "text-[13px] font-medium text-white tracking-wide" >
{ title }
< / h2 >
{ isLoading ? (
< div className = "space-y-1.5" >
< div className = "mt-4 flex" >
< p className = "text-xs bg-gradient-to-r from-gray-300 via-gray-100 to-gray-300 bg-clip-text text-transparent animate-pulse" >
Loading solutions . . .
< / p >
< / div >
< / div >
< / div >
) : (
< div className = "w-full" >
< SyntaxHighlighter
showLineNumbers
language = { currentLanguage == "golang" ? "go" : currentLanguage }
style = { dracula }
customStyle = { {
maxWidth : "100%" ,
margin : 0 ,
padding : "1rem" ,
whiteSpace : "pre-wrap" ,
wordBreak : "break-all" ,
backgroundColor : "rgba(22, 27, 34, 0.5)"
} }
wrapLongLines = { true }
>
{ content as string }
< / SyntaxHighlighter >
< / div >
) }
< / div >
)
) : (
< div className = "w-full relative" >
< button
onClick = { copyToClipboard }
className = "absolute top-2 right-2 text-xs text-white bg-white/10 hover:bg-white/20 rounded px-2 py-1 transition"
>
{ copied ? "Copied!" : "Copy" }
< / button >
< SyntaxHighlighter
showLineNumbers
language = { currentLanguage == "golang" ? "go" : currentLanguage }
style = { dracula }
customStyle = { {
maxWidth : "100%" ,
margin : 0 ,
padding : "1rem" ,
whiteSpace : "pre-wrap" ,
wordBreak : "break-all" ,
backgroundColor : "rgba(22, 27, 34, 0.5)"
} }
wrapLongLines = { true }
>
{ content as string }
< / SyntaxHighlighter >
< / div >
) }
< / div >
)
}
export const ComplexitySection = ( {
timeComplexity ,