-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add common
Styled System props to v6 components
#429
base: master
Are you sure you want to change the base?
Conversation
Gave |
DatePicker was previously using colors from "shared-styles".
|
Final version from da75a5d.
This is a kind of breaking change, please move this to a v6 version of the component. |
Instead of the old "shared-styles".
And restore the v5 DatePicker to a "legacy" export. This also involved some adjustments DatePeriodPicker's and DatePickerInput's calls of DatePicker, since the v6 DatePicker no longer needs to be wrapped. I also added the Styled System 'layout' props to DatePicker so DatePickerInput could use a 'width' prop on it.
`width: 100%` and `padding` together were causing the component to overflow its container on the right side by an amount equal to the sum of the left and right padding. `box-sizing: border-box` fixes that.
One change in c76ca22 (in -import { colors, thickness, fonts } from '../shared-styles';
+import { themeGet } from '@styled-system/theme-get';
...
export const DatePeriod = styled.div`
- font: ${fonts.ui14};
+ ${themeGet('textStyles.ui.14')}
...
`;
...
export const Label = styled.label`
...
- font: ${fonts.ui14};
+ ${themeGet('textStyles.ui.14')}
...
`; For context, here's styled-ui/components/shared-styles/index.js Lines 18 to 22 in 1e0c846
And here's Lines 89 to 93 in 1e0c846
It's the same set of styles, but since the first version was written Here's a before/after screenshot: All this to say, should I leave this at the smaller |
common
Styled System props to v6 components
Solid catch.
I'll check with our design team, but it can stay at |
I started with just Dropdown, as I was intending to add `common` style props to that family of components. Once I added propTypes for all Dropdown components, I found that each already accepted `common` props via one or another component they wrapped. Adding Dropdown propTypes created the necessity to add propTypes to the Button components, and in typing the `children` prop of SegmentedButtonGroup, I decided I wanted to make sure that that component's children were only `Button`s, so I created a new utility function: `elementOfType`. I used this function in DropdownMenu's propTypes as well. I also added some additional prop types to Popover.
I added One probably unexpected addition in baa4444, though, is a new utility function: styled-ui/components/utils/prop-types.js Lines 1 to 15 in 5e50f0d
I made it thinking it'd be nice to check component types of children on styled-ui/components/button/Button.js Lines 176 to 177 in 5e50f0d
styled-ui/components/dropdown/dropdown-menu.jsx Lines 69 to 81 in 5e50f0d
Is that overkill and I should just make those |
No objection to this. I suppose one soft objection would be that this would start logging warnings for cases where I pass in a wrapped version of one of those components, wouldn't it? |
I'm running through and adding the
common
and (when appropriate)typography
collections of Styled System props to components as per this comment on #378. Started with Accordion and I'm going to continue down alphabetically. 👍🏼