Skip to content
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

Merged
merged 3 commits into from
Feb 24, 2023
Merged

165 link proptypes #170

merged 3 commits into from
Feb 24, 2023

Conversation

alishaevn
Copy link
Member

@alishaevn alishaevn commented Feb 24, 2023

story

expected behavior

  • make the label required on a link. however, it can be an empty string if the desire is to only show an icon

demo

link with just text

image

link with text and an icon

image

link with just an icon

image

Comment on lines +7 to +13
return (
<a
href={href}
className={`link ${addClass}`}
style={style}
{...props}
>
Copy link
Member Author

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}
Copy link
Member Author

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.

Comment on lines +23 to +26
* 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.
Copy link
Member Author

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.

@alishaevn alishaevn linked an issue Feb 24, 2023 that may be closed by this pull request
2 tasks
@alishaevn alishaevn merged commit 6b477a7 into main Feb 24, 2023
@alishaevn alishaevn deleted the 165-link-proptypes branch February 27, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update Link prop types
2 participants