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