-
Notifications
You must be signed in to change notification settings - Fork 116
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 icon color for inverse variant #2713
Conversation
🦋 Changeset detectedLatest commit: 1f21e2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for paste-theme-designer ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for paste-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1f21e2d:
|
Size Change: +23 B (0%) Total Size: 748 kB
ℹ️ View Unchanged
|
a74d1ca
to
0a21e2d
Compare
0a21e2d
to
8dc4614
Compare
@@ -66,6 +66,7 @@ export const InputElement = React.forwardRef<HTMLInputElement, InputProps>(({ele | |||
width="100%" | |||
variant={props.variant} | |||
ref={ref} | |||
colorScheme={props.variant === 'inverse' ? 'dark' : 'normal'} |
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.
TODO: working on a test for this
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.
thought: the icon is also the wrong color when the component is in dark mode. Could we maybe make a token that we feed to a colorScheme prop that's 'normal' for default mode and 'dark' for dark mode? We'd then have to override it here for inverse mode, but I do think that the dark mode case is more common.
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.
@gloriliale thanks this PR doesn't check any sort of dark mode browser/OS preference or Paste theme setting (light vs dark) as I'm sure you know - just the variant provided via the prop to the input!
That all said, perhaps that is the wrong fix and we should table this PR entirely. I tried to put something together quickly on helper duty but your question is a good one! cc @SiTaggart @TheSisb et al
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 have some thoughts on this matter.
My first thought was to detect which theme was active and to use that information in this conditional, however we don't expose the current active theme from useTheme
or anything else. If we've made this this far without it, we probably don't want to expose it now. Thinking on it further, exposing that information can fracture our encapsulation which currently gives tokens so much power. I don't think components should/need to be aware of the theme; separation of concerns is good.
My next thought was akin to Glorilí, in that we could make a couple tokens for this:
default theme
:
color-scheme: 'light'
color-scheme-inverse: 'dark'
dark theme
:
color-scheme: 'dark'
color-scheme-inverse: 'light'
This way it works for any theme if they're dark or not, and let's people change the values for custom themes which may tend darker or lighter too.
And my third approach was to set the rule on our global css injeciton:
We set the class paste-theme-provider
in our ThemeProvider and we can set this CSS rule there globally based on the selected theme. (Ignore the fact I made it a unique id in my screenshot. This fixes it to work with multiple theme providers on the page at once, like in stacked view storybook).
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.
It feels like the token-based approach matches the way our system works the best. We don't have anything else that we set globally based on theme (the third option) do we?
8dc4614
to
1f21e2d
Compare
Closing in favour of #3130 |
Contributing to Twilio