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

fix(inline-notification): add 8px right padding if close button is hidden #4873

Merged
merged 9 commits into from
Dec 16, 2019
Merged

fix(inline-notification): add 8px right padding if close button is hidden #4873

merged 9 commits into from
Dec 16, 2019

Conversation

jendowns
Copy link
Contributor

@jendowns jendowns commented Dec 13, 2019

Closes #4864

Right now if you remove the close button in the InlineNotification (as shown in screenshots for #4864), the action button will be flush against the right side of the notification. For the low-contrast variation, this flush right margin is problematic because it overlaps the 1px low-contrast border.

This PR proposes adding a 1px right margin to the action button so that it won't be "flush" on the right side of the notification & also won't overlap the low-contrast border: Updated to 8px now

Changelog

Changed

  • add 8px right padding to the InlineNotification if hideCloseButton={true}

@jendowns jendowns requested a review from a team as a code owner December 13, 2019 16:01
@ghost ghost requested review from dakahn and joshblack December 13, 2019 16:01
@joshblack joshblack requested a review from a team December 13, 2019 16:09
@ghost ghost requested review from laurenmrice and removed request for a team December 13, 2019 16:09
@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for the-carbon-components ready!

Built with commit 66dbc79

https://deploy-preview-4873--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for carbon-components-react ready!

Built with commit 66dbc79

https://deploy-preview-4873--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for carbon-elements ready!

Built with commit 66dbc79

https://deploy-preview-4873--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for the-carbon-components ready!

Built with commit 0618c4a

https://deploy-preview-4873--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for carbon-components-react ready!

Built with commit 0618c4a

https://deploy-preview-4873--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Dec 13, 2019

Deploy preview for carbon-elements ready!

Built with commit 0618c4a

https://deploy-preview-4873--carbon-elements.netlify.com

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

If there is no close icon can we adjust the action button to be 8px away from the right hand side.

Screen Shot 2019-12-13 at 1 43 53 PM

@jendowns
Copy link
Contributor Author

Thank you @laurenmrice! I just committed an update to the right spacing so that should be reflected in the previews soonl. 👍

@joshblack I ended up changing how I added spacing... since the 8px spacing would only be present if hidenCloseButton={true}, I moved that logic to the component js. Could you take another look at what I did when you get a chance & let me know if you agree? Thank you!

@jendowns jendowns changed the title fix(inline-notification): add 1px right margin to action btn fix(inline-notification): add 8px right padding if close button is hidden Dec 13, 2019
Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

Thank you very much @jendowns for fixing!

role={role}
kind={kind}
className={classes}
style={{ paddingRight: hideCloseButton ? spacing03 : '0' }}>
Copy link
Contributor

@asudoh asudoh Dec 13, 2019

Choose a reason for hiding this comment

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

Any reason you didn't do this via Sass code (and update className upon hideCloseButton)...?

Copy link
Contributor Author

@jendowns jendowns Dec 14, 2019

Choose a reason for hiding this comment

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

Thanks @asudoh -- with the current structure of this component, the action button is a sibling to the close button & therefore it's difficult to target & change the action button when the close button is no longer present.

Adding a class is definitely a good alternative approach. I just went with the solution that (seemed to) add/remove the least. Would you prefer to add a class and keep the padding update in Sass only?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for sharing your thoughts @jendowns! I'm thinking about the ability of style override by applications, which tends to lean toward Sass approach. Is it changing className upon hideCloseButton enough to tell the Sass code that the close button is no longer present? If my words here is not clear enough please don't hesitate to speak up - Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point @asudoh -- I just committed a change that goes the classname + Sass route. Let me know what you think -- thank you!

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @jendowns for the update!

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Action link placement looks good. Can we take off the Example Link that comes after the normal text? I don't know if that happened in this pr, but I would rather only show the action link on the right.

@jendowns
Copy link
Contributor Author

jendowns commented Dec 16, 2019

Thanks @laurenmrice! If you don't mind, I was wondering if we could keep those example links there? 😅

I added them in a PR a week or so ago because a change went through that prevented clicking inside the notification body text. Without the example link there previously, the change went through undetected & had an effect on both gatsby-theme-carbon (mentioned here: #4804) and the carbon-website (mentioned here: carbon-design-system/carbon-website#655).

OH and I should add: technically since that notification body, or specifically the subtitle, accepts a node type, it can have a link passed into it by a user. Which is what we were seeing on both the Gatsby theme and the Carbon official website.

So keeping that link there could help catch any future issues with links in the body. 😅 What do you think?

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Okay we can keep it there thanks for explaining, will approve. I am wondering if it could eventually be something that you could turn off and on from the story? I am just wondering if people will be confused why there is a link and also an action link.

@jendowns
Copy link
Contributor Author

jendowns commented Dec 16, 2019

@laurenmrice Yeah that's a good question... I'm honestly not sure if storybook knobs can allow you to customize HTML elements (specifically the <a> element for this example link) which may make it hard to customize that InlineNotification body/subtitle nodes 🤔

BUT another option: I could add a storybook variation? Something you select on the sidebar? Right now there's Toast and Inline... there could be a new one like Inline without example link or the inverse, Inline with example link -- too much?

@laurenmrice
Copy link
Member

I think we can leave it for now and I can revisit that eventually :) thanks jen!

@asudoh asudoh merged commit 36b9762 into carbon-design-system:master Dec 16, 2019
joshblack pushed a commit to joshblack/carbon that referenced this pull request Jan 6, 2020
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.

[InlineNotification]: Action button is misaligned when close button is hidden
5 participants