-
Notifications
You must be signed in to change notification settings - Fork 34
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: DatePicker styles with updated spec #1697
Conversation
2d699a3
to
4b81bb7
Compare
transform: "translateY(-50%)", | ||
width: `${(2 / 16) * (16 / 14)}rem`, |
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 won't hold if someone overrides typography.fontSize
. What's the goal here? Maybe I can point you toward something safer.
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.
For ex, we use em
for our Status dots, so that they're always related to the size of the Status type:
"&::before": {
content: "''",
width: ".57em",
height: ".57em",
marginInlineEnd: theme.spacing(2),
borderRadius: "100%",
backgroundColor: theme.palette.text.secondary,
}
(We should probably have variables for these dot sizes, but you get the idea.)
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 someone overrides typography.fontSize
, you're saying it won't scale up the width
? Yeah, I'm assuming fonts sale with the HTML which is why I'm using rem
.
But if someone modifies the MUI font size which doesn't modify the html
element, then this 2px
won't be consistent with the MUI font size right?
But I agree, they should be set as token variables, not 2px
as rem
.
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.
Updated to this:
width: `${(2 / 16) * (16 / 14)}rem`, | |
width: '0.14285714285714285em', // 2px |
Actually, changed it to this instead so someone else (or me) doesn't have to do the math by hand:
width: `${(2 / 16) * (16 / 14)}rem`, | |
width: `${(2 / 16) * (16 / 14)}em`, |
This only works because the fontSize is FontScale1
. I think I need to change 16
to use FontScale1
, and we should be good, but then I'd be using calc()
instead which causes other issues. If I had access to the pixel values of our fonts, it'd be a lot more reliable, but this does scale properly if the font-size changes.
default: ({ theme }) => ({ | ||
backgroundColor: theme.palette.primary.main, | ||
content: '""', | ||
height: `${(16 / 16) * (16 / 14)}rem`, |
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.
Similar comment as above here. Could this be 1em
or theme.typography.body.fontSize
?
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 made it relative to the fontSize
. That makes sense here.
height: `${(16 / 16) * (16 / 14)}rem`, | |
height: theme.typography.body1.fontSize, |
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.
Actually, I changed this to h6
because 1rem
is actually 14px
rather than 16px
to match the text. FontScale2
. The icon needs to be sized 1 font size above the text to match the design.
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.
Totally cool to use fontSize
variables here. Another option I use sometimes is theme.typography.ui.lineHeight
, which is unitless. You can tag an em
on there to make it scale with the local font-size (which gives you 16px with 14px type).
I missed this during the initial PR. At 141 you have |
I agree completely, but MUI requires a fixed height here because it's using |
Good question re: the shifting sizes between displays. I prefer my containers sized to content, but @josesolano-okta and @taylorridgway-okta may want a uniform experience when clicking through the picker. |
As predicted, I'd prefer uniform width for both views if possible |
b9be9df
to
3e004da
Compare
content: '" "', | ||
height: `${(2 / 16) * (16 / 14)}rem`, | ||
height: `${(2 / 16) * (16 / 14)}em`, |
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.
Is this 2px
in Figma? If so, can prolly leave it as such here. The (16 / 14)
modifier won't make sense if someone rethemes the base fontSize
, since the proportional adjustment will be different.
If we do want it to scale with the font-size
, the calculated value might be better since it won't need to reference the global values at all. It's something Design should probably create a token for anyway.
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.
width: `${(2 / {theme.typography.fontSize})}em`
3e004da
to
bf7e783
Compare
* fix(odyssey-react-mui): don't require children prop for Icon buttons * fix: DatePicker styles with updated spec (#1697) * fix: added missing MuiThemeDecorator to DatePicker story * fix: adjusted spacing on DatePicker to match design * chore: updated yarn * fix: potential fix for local MUI and Labs development * fix: styled DatePicker to match new design spec * fix: add build before yarn start and fix order of yarn dev * fix: added missing DatePicker border * fix(odyssey-react-labs): improved selected vs "this year" styling * fix(odyssey-storybook): hover styles outside of month * fix(odyssey-storybook): removed MUI Month Picker styles * fix(odyssey-react-labs): added theme variables where they were hardcoded * fix(odyssey-react-labs): improved DatePicker styles to be more dynamic --------- Co-authored-by: Kamron Batmanghelich <kamron.batmanghelich@okta.com> * build: bump versions for v0.21.0 * docs: update CHANGELOG for v0.21.0 --------- Co-authored-by: Kevin Ghadyani <97464104+KevinGhadyani-Okta@users.noreply.github.com> Co-authored-by: Kamron Batmanghelich <kamron.batmanghelich@okta.com>
Description
Updated
DatePicker
styles with updated spec.