-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CopyButton prop for iconPosition
#2173
Conversation
🦋 Changeset detectedLatest commit: f6ee5fe The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Storybook demoEndringer til review: 1ccfabf28e | 48 komponenter | 310 stories |
@@ -63,6 +63,11 @@ export interface CopyButtonProps | |||
* @default 'Kopiert' | |||
*/ | |||
activeTitle?: string; | |||
/** | |||
* Icon position in Button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Liten "b" kanskje? Siden det ikke er snakk om Button-komponenten.
* Icon position in Button | |
* Icon position in button |
const CopyIcon = () => { | ||
return active ? ( | ||
<span className="navds-copybutton__icon"> | ||
{activeIcon ?? ( | ||
<CheckmarkIcon | ||
aria-hidden={!!text} | ||
title={text ? undefined : activeTitle} | ||
/> | ||
)} | ||
</span> | ||
) : ( | ||
<span className="navds-copybutton__icon"> | ||
{icon ?? ( | ||
<FilesIcon aria-hidden={!!text} title={text ? undefined : title} /> | ||
)} | ||
</span> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ingen big deal, men <span>
er repetert, og det er muligens litt dårlig praksis å definere komponenter inni komponenter. Forslag:
const CopyIcon = () => { | |
return active ? ( | |
<span className="navds-copybutton__icon"> | |
{activeIcon ?? ( | |
<CheckmarkIcon | |
aria-hidden={!!text} | |
title={text ? undefined : activeTitle} | |
/> | |
)} | |
</span> | |
) : ( | |
<span className="navds-copybutton__icon"> | |
{icon ?? ( | |
<FilesIcon aria-hidden={!!text} title={text ? undefined : title} /> | |
)} | |
</span> | |
); | |
}; | |
const CopyIcon = ( | |
<span className="navds-copybutton__icon"> | |
{active | |
? activeIcon ?? ( | |
<CheckmarkIcon | |
aria-hidden={!!text} | |
title={text ? undefined : activeTitle} | |
/> | |
) | |
: icon ?? ( | |
<FilesIcon | |
aria-hidden={!!text} | |
title={text ? undefined : title} | |
/> | |
)} | |
</span> | |
); |
Description
Resolves #2157
Change summary
iconPosition
for horisontal plassering av ikon. Samme API somButton