feat: improve key export page

closes #712
This commit is contained in:
2024-04-12 12:09:51 +01:00
parent f601e88b8f
commit 19d72722db
4 changed files with 31 additions and 18 deletions

View File

@ -10,11 +10,16 @@ export interface CopyProps {
maxSize?: number;
className?: string;
showText?: boolean;
mask?: string;
}
export default function Copy({ text, maxSize = 32, className, showText }: CopyProps) {
export default function Copy({ text, maxSize = 32, className, showText, mask }: CopyProps) {
const { copy, copied } = useCopy();
const sliceLength = maxSize / 2;
const trimmed = text.length > maxSize ? `${text.slice(0, sliceLength)}...${text.slice(-sliceLength)}` : text;
const displayText = mask ? mask.repeat(text.length) : text;
const trimmed =
displayText.length > maxSize
? `${displayText.slice(0, sliceLength)}...${displayText.slice(-sliceLength)}`
: displayText;
return (
<div className={classNames("copy flex pointer g8 items-center", className)} onClick={() => copy(text)}>