Merge remote-tracking branch 'upstream/main' into feat/connect-wallet

This commit is contained in:
Roland Bewick
2023-08-28 18:36:21 +07:00
96 changed files with 2569 additions and 3264 deletions

View File

@ -11,26 +11,13 @@ export interface CopyProps {
export default function Copy({ text, maxSize = 32, className, hideText }: CopyProps) {
const { copy, copied } = useCopy();
const sliceLength = maxSize / 2;
const trimmed =
text.length > maxSize
? `${text.slice(0, sliceLength)}...${text.slice(-sliceLength)}`
: text;
const trimmed = text.length > maxSize ? `${text.slice(0, sliceLength)}...${text.slice(-sliceLength)}` : text;
return (
<div
className={`copy${className ? ` ${className}` : ""}`}
onClick={() => copy(text)}
>
<div className={`copy${className ? ` ${className}` : ""}`} onClick={() => copy(text)}>
{!hideText && <span className="body">{trimmed}</span>}
<span
className="icon"
style={{ color: copied ? "var(--success)" : "var(--highlight)" }}
>
{copied ? (
<Icon name="check" size={14} />
) : (
<Icon name="copy" size={14} />
)}
<span className="icon" style={{ color: copied ? "var(--success)" : "var(--highlight)" }}>
{copied ? <Icon name="check" size={14} /> : <Icon name="copy" size={14} />}
</span>
</div>
);