-
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
Feature/config provider #614
base: feature/ant5
Are you sure you want to change the base?
Conversation
…rk with new versions
…um-website into feature/config-provider
<RouterSwitch /> | ||
</BrowserRouter> | ||
</Layout> | ||
<ConfigProvider theme={simulariumTheme} wave={{ disabled: true }}> |
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.
what is wave
?
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.
wave controls some animations that are hard to turn off individually
src/styles/theme/themeConfig.ts
Outdated
inputPlaceholderColor: WARM_GRAY, | ||
inputBorderColor: WARM_GRAY, | ||
inputBgColor: OFF_WHITE, | ||
inputHoverColor: BABY_PURPLE, |
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.
Overall this is nice, but some of the repetition here is more detailed than I think is necessary. For instance, I would have a single light AppBgColor, and then assign it below for both colorBgContainer
and inputBgColor
because you're always going to want those two to change together, instead of having a 1:1 of the token names in here. Similarly I would have a single pageBgColor: WHITE_SIX
and use it for the base and the layout. I'm also surprised you have to define the inputHoverColor separately, doesn't it already get the primaryColor?
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.
Ok I will do some consolidating!
src/styles/theme/themeConfig.ts
Outdated
menuDarkSelectedColor: PURE_WHITE, | ||
|
||
// Button | ||
buttonPrimaryColor: BABY_PURPLE, |
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.
again, doesn't this already get set by setting colorPrimary
?
src/styles/theme/themeConfig.ts
Outdated
tabsInkBarColor: DARK_FOUR, | ||
tabsItemHoverColor: DARK_FOUR, | ||
tabsItemActiveColor: DARK_FOUR, | ||
tabsItemSelectedColor: DARK_FOUR, |
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.
combine these into one variable tabsInteractionColor
or something
src/styles/theme/themeConfig.ts
Outdated
sliderRailHoverBg: WARM_GRAY, | ||
sliderTrackBg: WHITE_THREE, | ||
sliderHandleColor: WHITE_THREE, | ||
sliderDotBorderColor: WHITE_THREE, |
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.
also combine all these into one sliderColor
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, I think you should reduce your variables in your mappings though. The goal is when we change a color, we can change the fewest lines of code possible. I think it's a safe assumption that if things are currently the same color as each other we'll want to keep them the same color. So your theme definitions can have a lot fewer variables than the antd theme, and just reuse them (which you're doing in some places already)
src/styles/theme/themeConfig.ts
Outdated
// Layout | ||
layoutSiderBg: DARK, | ||
layoutTriggerBg: DARK, | ||
layoutTriggerColor: BABY_PURPLE, |
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.
Same thing as before: you positive you need to set this separately when you already have primary color set to baby purple?
const APP_BG_COLOR = OFF_WHITE; | ||
const TABS_INTERACTION_COLOR = DARK_FOUR; | ||
const SLIDER_COLOR = WHITE_THREE; | ||
const CHECKBOX_BG_COLOR = WHITE_SIX; |
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.
Nit: just call this LAYOUT_BG
and use it for colorBgBase
and colorBgLayout
below. or don't have both of those in your light theme and just set them in the actual theme.
src/styles/theme/themeConfig.ts
Outdated
const darkTheme = { | ||
// Layout | ||
layoutSiderBg: DARK, | ||
layoutTriggerBg: DARK, |
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.
nit: combine these into one variable
src/styles/theme/themeConfig.ts
Outdated
headerPadding: 0, | ||
siderBg: darkTheme.layoutSiderBg, | ||
triggerBg: darkTheme.layoutTriggerBg, | ||
triggerColor: darkTheme.layoutTriggerColor, |
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 do need to define this, I would just use colorPrimary
instead of making a new variable here, which makes it less clear that this just is the primary color
src/styles/theme/themeConfig.ts
Outdated
|
||
// Dropdown | ||
dropdownBgColor: CHARCOAL_GRAY, | ||
dropdownTextColor: TRANSPARENT_WHITE, |
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.
nit: call it FADED_WHITE
because transparent sounds like it's going to be invisible
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, I left a few more suggestions but nothing blocking
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!
const CHECKBOX_BG_COLOR = WHITE_SIX; | ||
|
||
// Light Theme Tokens (Global defaults, Modal, Radio) | ||
const lightTheme = { |
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've gotten confused working with this repo in the past by assuming that "light theme" and "dark theme" were different modes for the whole UI that could be switched between dynamically, rather than design concepts that statically apply to different UI elements (light theme for landing page, dark theme for viewer controls, etc.). Consider adding a few extra words to this comment to help out confused devs like my past self.
Also: even given that these "themes" apply to different UI elements, I'm a bit surprised that more effort isn't taken to unify the shapes of these objects, but that's out of scope for this PR anyways.
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.
Hate to say it but I think I have found an even better shiny new way of organizing these variables, so this may code might not last that long. This uses styled-components so is pending some buy-in from reviewer and Megan but I like it and its pointed at this branch. It gets rid of the light and dark theme naming you see here.
#616
I agree that the light/dark theme is confusing, and I am also hoping to get rid of the light-theme.css file in favor of some CSS-in-JS and actually using themes for theming when things are called themes.
Time estimate or Size
small
Problem
Advances #601 Closes #603 #604
With antd bumped to v5,
ant-vars.less
is deprecated and replaced byConfigProvider
.This PR is for making the switch and capturing the styles that were being handled by
less
.It is not a comprehensive fix of styling. Migrating lines from
ant-vars.less
is not sufficient to make things look right, and completing that process is out of scope.Solution
ant.var.less
App
withConfigProvider
and defineSimulariumTheme
with global and component tokens to mostly replace the styles applied in ant-vars.lesssimulariumTheme
used inConfigProvider
We can decide about having different antd theme algorithms going forward.
I think reasonable approval criteria here are:
ConfigProvider
styles is being appliedThe point here is to get rid of
ant-vars.less
, migrate the gist of what styles it was still handling, and establish theConfigProvider