Skip to content

Adding Tag Component #225

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

Merged
merged 4 commits into from
Mar 5, 2020
Merged

Adding Tag Component #225

merged 4 commits into from
Mar 5, 2020

Conversation

Lukeaber
Copy link
Collaborator

@Lukeaber Lukeaber commented Mar 2, 2020

Screenshot 2020-03-02 at 13 06 04

https://www.figma.com/file/9RzmjE0XYWWADWLKOJP5mR/PDS-UI-Components?node-id=135%3A1021

Ive added the tag component, styles, tests and a first run at docs

@Lukeaber Lukeaber requested a review from a team as a code owner March 2, 2020 13:07
Copy link
Contributor

@vine77 vine77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @Lukeaber! Just a few minor comments that should be easy enough for us to work out.

Comment on lines 23 to 28
<Button
className="rc-tag-remove-button"
onClick={() => onClick()}
icon="close"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wanted to be even more accessible here, we could add an aria-label to the button (which makes me realize we should do that in the other icon button examples).

Suggested change
<Button
className="rc-tag-remove-button"
onClick={() => onClick()}
icon="close"
/>
<Button
className="rc-tag-remove-button"
onClick={() => onClick()}
icon="close"
aria-label="Remove tag"
/>

There's probably some way to use aria-labelledby to create a relationship between the Tag text and the button, but that might require id generation. I think the above use of aria-label would suffice.


const propTypes = {
/** Tag text or other content */
children: node.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we know we need to accept arbitrary content, can we add something like a label string prop instead? (I could see the future use of an icon on the left, but we can either add a new prop for that when the time comes or readdress children.) To be clear, I'm usually in favor of adding the "escape hatch" of adding children as a prop to increase flexibility, but in this case, we're going to need to style the text and a separate prop would leave the door open for adding aria-labelledby.

Comment on lines 17 to 22
.rc-tag-text {
color: $puppet-white;
height: fit-content;
padding-left: 8px;
padding-right: 4px;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the spec in Figma uses a font of Calibre, 14px, bold (like h5) instead of the default Open Sans font. This obviously isn't a header though, so I'd like to confirm the typography with @Sigler. There's a precedent to using Calibre in non-headers with form labels, but if we're going to continue to do things like that, we need a simple way of defining and using those typographic styles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same font as font as button, so let's just add @include puppet-type-button() like in _button.scss.

@Lukeaber Lukeaber force-pushed the PDS-452-Create-Tag-Component branch 3 times, most recently from e9cebd1 to 4e97e55 Compare March 5, 2020 11:04
@Lukeaber Lukeaber force-pushed the PDS-452-Create-Tag-Component branch from 4e97e55 to 9d381af Compare March 5, 2020 12:02
.rc-tag-text {
color: $puppet-white;
height: fit-content;
padding-left: 8px;
Copy link
Contributor

@vine77 vine77 Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The left padding also seems too tight to me (though I can see an 8px in Figma). I'd suggest copying the padding of button:

Suggested change
padding-left: 8px;
padding-left: 15px;

@Lukeaber
Copy link
Collaborator Author

Lukeaber commented Mar 5, 2020

Screenshot 2020-03-05 at 15 25 00

Copy link
Contributor

@vine77 vine77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Tag, you're it

@vine77 vine77 merged commit cb97ca1 into master Mar 5, 2020
@vine77 vine77 deleted the PDS-452-Create-Tag-Component branch March 5, 2020 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants