* Update ScriptAccordion and ScriptItem components for improved styling * Add README.md for Proxmox VE Helper-Scripts Frontend * Remove testing dependencies and related test files from the frontend project * Update analytics URL in siteConfig to point to community-scripts.org * Refactor ESLint configuration to have one source of truth and run "npm lint" to apply new changes * Update lint script in package.json to remove npm * Add 'next' option to ESLint configuration for improved compatibility * Update package dependencies and versions in package.json and package-lock.json * Refactor theme provider import and enhance calendar component for dynamic icon rendering * rename sidebar, alerts and buttons * rename description and interfaces files * rename more files * change folder name * Refactor tooltip logic to improve updateable condition handling * Enhance CommandMenu to prevent duplicate scripts across categories * Remove test step from frontend CI/CD workflow
31 lines
741 B
TypeScript
31 lines
741 B
TypeScript
import { ClipboardIcon } from "lucide-react";
|
|
|
|
import handleCopy from "./handle-copy";
|
|
|
|
export default function TextCopyBlock(description: string) {
|
|
const pattern = /`([^`]*)`/g;
|
|
const parts = description.split(pattern);
|
|
|
|
const formattedDescription = parts.map((part: string, index: number) => {
|
|
if (index % 2 === 1) {
|
|
return (
|
|
<span
|
|
key={index}
|
|
className="bg-secondary py-1 px-2 rounded-lg inline-flex items-center gap-2"
|
|
>
|
|
{part}
|
|
<ClipboardIcon
|
|
className="size-3 cursor-pointer"
|
|
onClick={() => handleCopy("command", part)}
|
|
/>
|
|
</span>
|
|
);
|
|
}
|
|
else {
|
|
return part;
|
|
}
|
|
});
|
|
|
|
return formattedDescription;
|
|
}
|