Skip to content

Commit

Permalink
🐛 Now accounts for custom icons in legacy CopyButton
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Feb 4, 2025
1 parent df3f24e commit b625735
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions @navikt/core/react/src/copybutton/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(

const activeString = activeText || translate("activeText");

const copyIcon = active
? activeIcon ?? (
<LegacyIconWrapper useLegacy={!themeContext}>
<CheckmarkIcon
aria-hidden={!!text}
title={text ? undefined : activeString}
className={themeContext ? "navds-copybutton__icon" : undefined}
/>
</LegacyIconWrapper>
)
: icon ?? (
<LegacyIconWrapper useLegacy={!themeContext}>
<FilesIcon
aria-hidden={!!text}
title={text ? undefined : title || translate("title")}
className={themeContext ? "navds-copybutton__icon" : undefined}
/>
</LegacyIconWrapper>
);
const copyIcon = (
<LegacyIconWrapper useLegacy={!themeContext}>
{active
? activeIcon ?? (
<CheckmarkIcon
aria-hidden={!!text}
title={text ? undefined : activeString}
className={themeContext ? "navds-copybutton__icon" : undefined}
/>
)
: icon ?? (
<FilesIcon
aria-hidden={!!text}
title={text ? undefined : title || translate("title")}
className={themeContext ? "navds-copybutton__icon" : undefined}
/>
)}
</LegacyIconWrapper>
);

if (themeContext) {
return (
Expand Down

0 comments on commit b625735

Please sign in to comment.