Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"dependencies": {
"@docsearch/react": "^4.6.0",
"@react-spring/web": "^10.0.3",
"clsx": "^2.1.1",
"path-browserify": "^1.0.1",
"prop-types": "^15.8.1",
"react": "^19.2.4",
Expand All @@ -84,6 +85,7 @@
"react-router-dom": "^7.13.1",
"react-tiny-popover": "^8.1.6",
"react-use": "^17.6.0",
"tailwind-merge": "^3.5.0",
"webpack-pwa-manifest": "^4.3.0",
"workbox-window": "^7.4.0"
},
Expand Down
18 changes: 15 additions & 3 deletions src/components/CodeBlockWithCopy/CodeBlockWithCopy.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from "prop-types";
import { useEffect, useRef, useState } from "react";
import "./CodeBlockWithCopy.scss";
import { cn } from "../../utilities/cn.mjs";

export default function CodeBlockWithCopy({ children }) {
const preRef = useRef(null);
Expand Down Expand Up @@ -115,10 +115,22 @@ export default function CodeBlockWithCopy({ children }) {
);

return (
<div className="code-block-wrapper">
<div className="code-block-wrapper relative mb-6 group">
<button
onClick={handleCopy}
className={`copy-button ${copyStatus}`}
className={cn(
"copy-button",
"absolute top-2 right-2 z-10 px-[0.7rem] py-[0.4rem] rounded-[0.35rem] border-none cursor-pointer text-xs font-medium text-slate-200",
"opacity-0 group-hover:opacity-100",
"transition-[background-color,transform,opacity] duration-200",
"active:scale-95",
"focus-visible:outline-none focus-visible:opacity-100",
copyStatus === "copied"
? "bg-green-600 hover:bg-green-700"
: copyStatus === "error"
? "bg-red-500 hover:bg-red-700"
: "bg-[#175d96] hover:bg-[#2f85d0]",
)}
aria-label="Copy code to clipboard"
>
{copyStatus === "copied"
Expand Down
66 changes: 0 additions & 66 deletions src/components/CodeBlockWithCopy/CodeBlockWithCopy.scss

This file was deleted.

5 changes: 5 additions & 0 deletions src/utilities/cn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export const cn = (...inputs) => twMerge(clsx(...inputs));
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4576,6 +4576,11 @@ clone-deep@^4.0.1:
kind-of "^6.0.2"
shallow-clone "^3.0.0"

clsx@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999"
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==

co@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
Expand Down Expand Up @@ -13387,6 +13392,11 @@ table-layout@^1.0.1:
typical "^5.2.0"
wordwrapjs "^4.0.0"

tailwind-merge@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-3.5.0.tgz#06502f4496ba15151445d97d916a26564d50d1ca"
integrity sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A==

tailwindcss@4.2.1, tailwindcss@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-4.2.1.tgz#018c4720b58baf98a6bf56b0a12aa797c6cfef1d"
Expand Down
Loading