-
Notifications
You must be signed in to change notification settings - Fork 6
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
Announcement component using USWDS #1031
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
6c600bd
to
bfa2b31
Compare
…a-ui into 288-announcement
Add banner configuration to mock config
b1bf058
to
60a57d6
Compare
postcss.config.js
Outdated
@@ -4,5 +4,15 @@ module.exports = { | |||
plugins: [ | |||
require('autoprefixer'), | |||
require('postcss-import'), | |||
require('@fullhuman/postcss-purgecss')({ |
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 styles doesn't get hot-reloaded unfortunately :[ (I have to restart the dev server if I want to include a new class name etc.)
<div> | ||
{isOpen && | ||
(<div className='position-relative'> | ||
<USWDSBanner aria-label={appTitle} className={type !== infoTypeFlag? 'bg-secondary-lighter': ''}> |
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.
Floagging that this component uses uswds default color theme now: https://designsystem.digital.gov/design-tokens/color/theme-tokens/
I don't want to drag this PR with another configuration setup especially considering there hasn't been a request for a different type of banner. (But then it might be better to just get rid of this special styling for now?)
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.
Until needed I'm in support of the default theme 👍
@hanbyul-here could you add steps on how to configure the banner to test this PR? Thanks! 🙇 |
Hmm this is more of a thought pattern of how we may want to use USWDS components within our codebase. My thought is it might be a good pattern to create a wrapper for all USWDS components we use in our codebase and then forward props... this way it creates a pattern where it can be easily decoupled from breaking changes that the DS could introduce later on in the future (this may or may not happen but we'd be easily prepared)... and then just also it creates a decoupling layer in general. If there are any changes that happen to the DS component, it would also isolate us to just having a make a change in one place (the wrapper) instead of throughout our codebase, if that makes sense. What this would look like is having a Design System directory for USWDS with our wrappers around these components. Then other components in our codebase would reference our internal directory. What do you think? |
@dzole0311 No wonder you couldn't see the banner—I configured it wrong 😓 . You should be able to see it now. I also added a document about adding it through the configuration file. @sandrahoang686 I never had experience with the pattern that you suggested. I tried to educate myself a bit, and some people like the pattern because of the pros you mentioned, and others caution that it may introduce additional complexity and maintenance requirements. It is difficult for me to form an opinion on this issue without hands-on experience. Since we are changing our design system, do you mind giving me a concrete example of how we could have benefited from the pattern if we used it for the devseed ui library? |
ce52543
to
57ef36e
Compare
@hanbyul-here sure, you already are implementing the pattern actually 😅. What you did was wrap the DS I'm just thinking though, does it make sense to create a directory |
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.
Looks great, thanks for adding the first USWDS component in the Dashboard 🥳
To follow up on our discussion from the other day, I'm in favor of a simple structure like the one used in the PR, but I’m also open to the idea of nesting the components in an additional subdirectory (as @sandrahoang686 suggested). It’s a minor adjustment, so I'll leave the decision to you.
I made the directory of While doing it, I was really not sure if this is the way you pictured it, @sandrahoang686. I will merge this PR so as not to spill the scope, but please feel free to make follow-up edits if you see any improvement. |
@dzole0311 @sandrahoang686 Another note that I made purgecss not to kick in when |
"simple structure" is opinion based as both are simple.. its just organization and points of reference in the code. When there is a directory we can follow that has all the USWDS or whatever DS elements with simple wrappers its easy to pinpoint, follow patterns, and quicker to decouple. While having it blended with other common component just doesn't provide that clear distinction and pattern standard. But most important pattern is there which is not using USWDS directly in our components 👍🏼 the organization and logic looks good to me |
**HOLD until we merge #1073 ## 🎉 Features * Added Announcement component using USWDS Design System and adding purge-css #1031 ## 🚀 Improvements * Add logic for tracking out-of-view Timeline playheads for E&A page #1067 * Abstract Away Faux Modules from MapBlock Component and expose as library component #1046 ## 🐛 Fixes - 🦗
I made banner as a part of veda config: https://github.com/NASA-IMPACT/veda-ui/pull/1031/files#diff-828262a6a39b2c45c85b5fcdf1b4615ff5d3d69f662078fd27aa9846fb29f36fR20 (Compare this configuration to the current setup: https://github.com/US-GHG-Center/veda-config-ghg/blob/develop/veda.config.js#L45-L49)
I structured the component with the ongoing refactoring in mind. But let me know if you see any problem 🙇
I also re-introduced purge-css because I wanted to use utility classes from uswds. This comes with some prices ex. manual safelist and no hot reloading. I left a comment in the code, I am open to taking a different approach,