-
Notifications
You must be signed in to change notification settings - Fork 0
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
165 link proptypes #170
165 link proptypes #170
Conversation
… if the desire is to only show an icon
return ( | ||
<a | ||
href={href} | ||
className={`link ${addClass}`} | ||
style={style} | ||
{...props} | ||
> |
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.
the majority of this is indention.
{icon && ( | ||
<FontAwesomeIcon icon={icon} className={`small ${label.length && 'me-2'}`} /> | ||
)} | ||
{label && label} |
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.
only show the label if it isn't an empty string.
* there isn't an easy way to require either the icon OR the label. there are additional packages we could install that have the | ||
* capability, but that would bloat the package unnecessarily. instead, we're requiring that the label be passed. the overwhelming | ||
* majority of instances where a link is used, will want a label anyway. however, in the event a label isn't desired, passing the | ||
* value as an empty string will satisfy prop types, while still only showing an icon. |
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.
I tried this suggestion, but it felt like overkill.
story
expected behavior
demo
link with just text
link with text and an icon
link with just an icon