@ -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)}>
|
||||
|
Reference in New Issue
Block a user