-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update overlay components to new theme system #209
Conversation
Just added an unrelated fix for Checkbox and Radio vertical alignment. |
Just added an unrelated fix for Grouper alignment. |
@@ -1,24 +1,33 @@ | |||
import React from "react"; | |||
import PropTypes from "prop-types"; | |||
import { transparentize } from "polished"; |
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.
remove
minWidth: ${themeGet("dialog.minWidths.minWidth")}; | ||
maxWidth: ${themeGet("dialog.maxWidths.maxWidth")}; | ||
minHeight: ${themeGet("dialog.minHeights.minHeight")}; | ||
maxHeight: ${themeGet("dialog.maxHeights.maxHeight")}; |
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.
incorrect syntax
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.
Gah! I keep doing that.
@@ -70,7 +79,7 @@ const Dialog = ({ | |||
display: 'flex', | |||
justifyContent: 'center', | |||
alignItems: 'center', | |||
backgroundColor: `rgba(0, 0, 0, ${themeGet(`opacity.${opacity}`, opacity)(props)})`, | |||
backgroundColor: `rgba(0, 0, 0, ${opacity})`, |
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.
we might consider allowing user-defined colors here.
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 that – it's actually the source of that stray polished transparentize
import – but couldn't get it working. Decided to punt for now. I'll open an issue.
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 following should work:
const overlayStyle = {
...
background: transparentize(opacity, backdropColor)
}
And obviously, you would then need to pass backdropColor
as a prop and pass a defaultProp value.
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.
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 biggest downside to this approach is the lack of access to the theme. That might require a larger rewrite.
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.
Yeah the problem I had was supporting the overlay color in the theme file too. Would have to add some logic to use the prop if present, else fallback on the theme. We do this a lot inside our styled component definitions, but not in a standalone const
. I'm sure it's doable, I just hit a wall and so punted.
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.
Okay, yeah that's fair. Agreed on the issue then.
Notable props include `opacity` for adjusting the scrim opacity, `boxShadow` for | ||
setting the dialog drop shadow, and `closeTimeoutMS` for adjusting the transition | ||
timing. Transitions are hard-coded for now. Only the timing is adjustable. | ||
Overlay opacity can be adjusted via the `opacity` prop. |
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.
If you end up making the suggested change about user-defined colors, update this as well.
@@ -49,7 +45,7 @@ const ButtonLoading = styled.span` | |||
align-items: center; | |||
justify-content: center; | |||
|
|||
> ${ButtonIcon} { | |||
> .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.
Nothing wrong with this change, just curious about the decision behind it.
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.
ButtonIcon
was a styled(Icon)
. I've opted to stop using that syntax entirely (in favor of styled.div
or other built-in html elements), so I just used the Icon
component directly in the jsx. Hence needed to give it a classname to refer to it here.
@@ -7,47 +7,89 @@ route: /overlays/dialog | |||
import { Playground, Props } from 'docz' | |||
import Dialog from './' | |||
import Button from '../../../core/components/button' | |||
import Heading from '../../../core/components/heading' |
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.
these imports can simply be '../button'
and '../heading'
@@ -1,38 +1,43 @@ | |||
import React from "react"; | |||
import PropTypes from "prop-types"; | |||
import styled, { css } from "styled-components"; |
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.
css import not needed
Thanks for catching all those. Ready for another look. |
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 good
* Add aria-hidden to Callout icon and Breadcrumbs icons * Remove styled(Icon) from Button. Add aria attributes. * Update Tooltip to new theme system * Update Dialog to new theme system * Align Checkbox and Radio * Add justify prop to Grouper
Target Branch
Note this is a request to merge to
feature/theme
, notdevelop
. All theme-related PRs should targetfeature/theme
until the theme upgrade is complete.Overview
Updates the following components to the new theme system:
Updates the Dialog docs page with a fully working example and clearer instructions for how to close the dialog.
Checklist
Upgrade instructions
If there are any of the following in this PR, provide proper instructions on how to upgrade:
Notes
Did a some drive-by tweaks to Callout, Breadcrumbs, Button.
This PR does not change the underlying tooltip and dialog libraries used by Tooltip and Dialog.
Testing Instructions
Closes #171
Closes #172
Closes #131
Closes #205