1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-05 20:15:31 -04:00

add language indicator to code blocks

This commit is contained in:
2025-05-07 20:01:12 -04:00
parent 6fd7c9fc4a
commit fff705f1e8
15 changed files with 90 additions and 59 deletions
+3 -2
View File
@@ -3,13 +3,14 @@
import { forwardRef, useState, useEffect } from "react";
import copy from "copy-to-clipboard";
import { ClipboardIcon, CheckIcon } from "lucide-react";
import { cn } from "@/lib/utils";
import type { Ref, ComponentPropsWithoutRef, ComponentRef, MouseEventHandler } from "react";
const CopyButton = (
{
source,
timeout = 2000,
style,
className,
...rest
}: ComponentPropsWithoutRef<"button"> & {
source: string;
@@ -51,7 +52,7 @@ const CopyButton = (
ref={ref}
onClick={handleCopy}
disabled={copied}
style={{ cursor: copied ? "default" : "pointer", ...style }}
className={cn("cursor-pointer disabled:cursor-default", className)}
{...rest}
>
{copied ? <CheckIcon className="stroke-success" /> : <ClipboardIcon />}