Skip to content

Commit 55c9f56

Browse files
committed
refactor(CodeBlockWithCopy): migrate from SCSS to Tailwind CSS
1 parent 29288b2 commit 55c9f56

2 files changed

Lines changed: 11 additions & 69 deletions

File tree

src/components/CodeBlockWithCopy/CodeBlockWithCopy.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from "prop-types";
22
import { useEffect, useRef, useState } from "react";
3-
import "./CodeBlockWithCopy.scss";
3+
// Tailwind CSS is now used for styling. Custom SCSS removed.
44

55
export default function CodeBlockWithCopy({ children }) {
66
const preRef = useRef(null);
@@ -115,11 +115,19 @@ export default function CodeBlockWithCopy({ children }) {
115115
);
116116

117117
return (
118-
<div className="code-block-wrapper">
118+
<div className="relative mb-6 group">
119119
<button
120120
onClick={handleCopy}
121-
className={`copy-button ${copyStatus}`}
122121
aria-label="Copy code to clipboard"
122+
className={`absolute top-2 right-2 z-10 px-3 py-1.5 rounded-md border-none cursor-pointer text-xs font-medium opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-all duration-300
123+
${
124+
copyStatus === "copied"
125+
? "bg-green-600 hover:bg-green-700 text-gray-100"
126+
: copyStatus === "error"
127+
? "bg-red-600 hover:bg-red-700 text-gray-100"
128+
: "bg-blue-700 hover:bg-blue-600 text-blue-100"
129+
}
130+
active:scale-95 focus:outline-none`}
123131
>
124132
{copyStatus === "copied"
125133
? "Copied!"

src/components/CodeBlockWithCopy/CodeBlockWithCopy.scss

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)