From 46f9ba5d8c295454381655e6ec02ad3cf8bd79db Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 6 Mar 2026 02:18:40 +0900 Subject: style: switch from tab to space indentation in frontend and worker/php Update biome.json indentStyle from "tab" to "space" and reformat all files in both workspaces. Co-Authored-By: Claude Opus 4.6 --- frontend/app/components/Gaming/CodeBlock.tsx | 94 ++++++++++++++-------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'frontend/app/components/Gaming/CodeBlock.tsx') diff --git a/frontend/app/components/Gaming/CodeBlock.tsx b/frontend/app/components/Gaming/CodeBlock.tsx index 2107f94..f048a38 100644 --- a/frontend/app/components/Gaming/CodeBlock.tsx +++ b/frontend/app/components/Gaming/CodeBlock.tsx @@ -4,60 +4,60 @@ import { JSX, useLayoutEffect, useState } from "react"; import { type BundledLanguage, highlight } from "../../highlight"; type Props = { - code: string; - language: BundledLanguage; + code: string; + language: BundledLanguage; }; function Plaintext({ code }: { code: string }) { - const lines = code.split("\n"); - return ( -
-			
-				{lines.map((line, i) => (
-					
-						{line}
-						{i < lines.length - 1 ? "\n" : ""}
-					
-				))}
-			
-		
- ); + const lines = code.split("\n"); + return ( +
+      
+        {lines.map((line, i) => (
+          
+            {line}
+            {i < lines.length - 1 ? "\n" : ""}
+          
+        ))}
+      
+    
+ ); } export default function CodeBlock({ code, language }: Props) { - const [nodes, setNodes] = useState(null); - const [showCopied, setShowCopied] = useState(false); + const [nodes, setNodes] = useState(null); + const [showCopied, setShowCopied] = useState(false); - useLayoutEffect(() => { - highlight(code, language) - .then(setNodes) - .catch(() => setNodes(null)); - }, [code, language]); + useLayoutEffect(() => { + highlight(code, language) + .then(setNodes) + .catch(() => setNodes(null)); + }, [code, language]); - const handleCopy = () => { - navigator.clipboard.writeText(code).then(() => { - setShowCopied(true); - setTimeout(() => setShowCopied(false), 3000); - }); - }; + const handleCopy = () => { + navigator.clipboard.writeText(code).then(() => { + setShowCopied(true); + setTimeout(() => setShowCopied(false), 3000); + }); + }; - return ( -
- {code !== "" && ( - - )} -
- {nodes ?? } - </div> - </div> - ); + return ( + <div className="relative"> + {code !== "" && ( + <button + onClick={handleCopy} + className="absolute top-2 right-2 z-10 px-2 py-1 bg-white border border-gray-300 rounded shadow-md hover:bg-gray-100 transition-colors" + title="コードをコピーする" + > + <FontAwesomeIcon icon={faCopy} className="text-gray-600" /> + {showCopied && ( + <span className="ml-1 text-xs text-brand-600">Copied!</span> + )} + </button> + )} + <div className="shiki h-full w-full p-2 pr-12 bg-white rounded-lg border border-gray-300 whitespace-pre-wrap break-words"> + {nodes ?? <Plaintext code={code} />} + </div> + </div> + ); } -- cgit v1.3.1