Skip to content

Commit

Permalink
chore: destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Feb 27, 2024
1 parent faf4097 commit 237bc57
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/typography/Base/CopyBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ export interface CopyBtnProps extends CopyConfig {
}

export default function CopyBtn(props: CopyBtnProps) {
const { prefixCls, copied, locale, onCopy, iconOnly, tooltips, icon } = props;
const { prefixCls, copied, locale = {}, onCopy, iconOnly, tooltips, icon } = props;

const tooltipNodes = toList(tooltips);
const iconNodes = toList(icon);

const { copied: copiedText, copy: copyText } = locale;

const copyTitle = copied
? getNode(tooltipNodes[1], locale?.copied)
: getNode(tooltipNodes[0], locale?.copy);
const systemStr = copied ? locale?.copied : locale?.copy;
? getNode(tooltipNodes[1], copiedText)
: getNode(tooltipNodes[0], copyText);
const systemStr = copied ? copiedText : copyText;
const ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;

return (
Expand Down

0 comments on commit 237bc57

Please sign in to comment.