gabotorresruiz commented on code in PR #35220:
URL: https://github.com/apache/superset/pull/35220#discussion_r2373174639
##########
superset-frontend/src/pages/ThemeList/index.tsx:
##########
@@ -340,14 +360,28 @@ function ThemesList({
)}
{original.is_system_default && (
<Tooltip title={t('This is the system default theme')}>
- <Tag color="warning">
+ <Tag
+ color="warning"
+ css={theme => css`
+ display: flex;
+ align-items: center;
+ gap: ${theme.sizeUnit}px;
+ `}
+ >
<Icons.SunOutlined /> {t('Default')}
</Tag>
</Tooltip>
)}
{original.is_system_dark && (
<Tooltip title={t('This is the system dark theme')}>
- <Tag color="default">
+ <Tag
+ color="default"
Review Comment:
You're right! I think I found a "better/elegant" way of doing this
##########
superset-frontend/packages/superset-ui-core/src/theme/Theme.tsx:
##########
@@ -118,9 +53,48 @@ export class Theme {
* If simple tokens are provided as { token: {...} }, they will be applied
with defaults
* If no config is provided, uses default tokens
* Dark mode can be set via the algorithm property in the config
+ * @param config - The theme configuration
+ * @param baseTheme - Optional base theme to apply under the config
*/
- static fromConfig(config?: AnyThemeConfig): Theme {
- return new Theme({ config });
+ static fromConfig(
+ config?: AnyThemeConfig,
+ baseTheme?: AnyThemeConfig,
+ ): Theme {
+ let mergedConfig: AnyThemeConfig | undefined = config;
+
+ if (baseTheme && config) {
+ mergedConfig = {
+ ...baseTheme,
+ ...config,
+ } as AnyThemeConfig;
+
+ if (baseTheme.token || config.token) {
+ (mergedConfig as any).token = {
+ ...(baseTheme.token || {}),
+ ...(config.token || {}),
+ };
+ }
+
+ if (baseTheme.components || config.components) {
Review Comment:
Yep, `mergeWith` will do the trick. Nice catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]