style: fmt code

This commit is contained in:
ReaJason
2026-04-26 21:33:15 +08:00
parent d10323a054
commit ee560ff7ee
150 changed files with 948 additions and 1522 deletions
+8 -16
View File
@@ -1,18 +1,14 @@
import type { VariantProps } from "class-variance-authority";
import { Check, Copy } from "lucide-react";
import {
type HTMLProps,
type ReactNode,
useCallback,
useEffect,
useState,
} from "react";
import { type HTMLProps, type ReactNode, useCallback, useEffect, useState } from "react";
import CopyToClipboard from "react-copy-to-clipboard";
import { useTranslation } from "react-i18next";
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
import java from "react-syntax-highlighter/dist/esm/languages/prism/java";
import materialDark from "react-syntax-highlighter/dist/esm/styles/prism/material-dark";
import { toast } from "sonner";
import { Button, type buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
@@ -68,17 +64,13 @@ export default function CodeViewer({
showLineNumbers = true,
wrapLongLines = true,
}: Readonly<CodeViewerProps>) {
const lineProps: lineTagPropsFunction | HTMLProps<HTMLElement> | undefined =
wrapLongLines
? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } }
: undefined;
const lineProps: lineTagPropsFunction | HTMLProps<HTMLElement> | undefined = wrapLongLines
? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } }
: undefined;
return (
<div className="rounded-lg border">
<div
className={cn(
"flex items-center border-b p-2 justify-end",
header && "justify-between",
)}
className={cn("flex items-center justify-end border-b p-2", header && "justify-between")}
>
{header}
<div className="flex items-center gap-2">
@@ -86,7 +78,7 @@ export default function CodeViewer({
<CopyButton value={code} variant="ghost" size="sm" />
</div>
</div>
<div className="relative overflow-hidden text-xs wrap-all">
<div className="wrap-all relative overflow-hidden text-xs">
<SyntaxHighlighter
language={language}
style={materialDark}