geido commented on code in PR #31590:
URL: https://github.com/apache/superset/pull/31590#discussion_r1930831501
##########
superset-frontend/packages/superset-ui-chart-controls/src/components/ColumnTypeLabel/ColumnTypeLabel.tsx:
##########
@@ -37,9 +37,9 @@ const TypeIconWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
- width: ${theme.gridUnit * 6}px;
- height: ${theme.gridUnit * 6}px;
- margin-right: ${theme.gridUnit}px;
+ width: ${theme.sizeUnit * 6}px;
+ height: ${theme.sizeUnit * 6}px;
Review Comment:
I’ve always been skeptical about using gridUnit or the new sizeUnit for
widths and heights. I don’t believe changing the base value of these units will
have the same meaningful impact on sizes as it does on paddings and margins,
which are inherently more predictable and consistent by nature.
##########
superset-frontend/packages/superset-ui-core/src/theme/types.ts:
##########
@@ -0,0 +1,334 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable @typescript-eslint/no-unused-vars */
+// eslint-disable-next-line no-restricted-syntax
+import { theme as antdThemeImport } from 'antd-v5';
+
+/**
+ * Grab all antd tokens via getDesignToken(...).
+ * (Same as in the original file.)
+ */
+export type AntdTokens = ReturnType<typeof antdThemeImport.getDesignToken>;
+
+/** Minimal color system references. */
+export interface SystemColors {
+ colorPrimary: string;
+ colorError: string;
+ colorWarning: string;
+ colorSuccess: string;
+ colorInfo: string;
+}
+
+export interface ColorVariants {
+ bg: string;
+ border: string;
+ hover: string;
+ active: string;
+ textHover: string;
+ text: string;
+ borderHover: string;
+ bgHover: string;
+ textActive: string;
+}
+
+export interface DeprecatedColorVariations {
+ base: string;
+ light1: string;
+ light2: string;
+ light3: string;
+ light4: string;
+ light5: string;
+ dark1: string;
+ dark2: string;
+ dark3: string;
+ dark4: string;
+ dark5: string;
+}
+
+export interface DeprecatedThemeColors {
+ primary: DeprecatedColorVariations;
+ error: DeprecatedColorVariations;
+ warning: DeprecatedColorVariations;
+ success: DeprecatedColorVariations;
+ info: DeprecatedColorVariations;
+ grayscale: DeprecatedColorVariations;
+}
+
+export interface LegacySupersetTheme {
+ // Old colors structure with light/dark semantics still heavily referenced
in code base
+ // TODO: replace/realign with antd-type tokens
+ colors: DeprecatedThemeColors;
+ transitionTiming: number;
+}
+
+export interface SupersetSpecificTokens {
+ // Brand-related
+ brandIconMaxWidth: number;
+
+ // Font-related
+ fontSizeXS: string;
+ fontSizeXXL: string;
+ fontWeightNormal: string;
+ fontWeightLight: string;
+ fontWeightMedium: string;
+}
+
+/**
+ * This array is used to define which keys from the full Antd token set
+ * we actually allow in the SupersetTheme.
+ */
+export const allowedAntdTokens = [
Review Comment:
A few questions / concerns about this mapping:
- Not sure if we considered the maintenance costs of owning this VS just let
them all but I was curious about your thoughts
- Sizes and spacing: Many components are being overridden for size and
spacing to keep the layout in place. Should we allow the theme to mess with
sizes and spaces or is it something that should be "hardcoded" in the frontend
as it can compromise the layout? I am unsure how much flexible is our layout
currently and I am pretty sure that a subtle change might cause it to break. If
we give the option then we might as well have to support it.
##########
superset-frontend/packages/superset-ui-chart-controls/src/components/SQLPopover.tsx:
##########
@@ -66,8 +66,8 @@ export const SQLPopover = (props: PopoverProps & {
sqlExpression: string }) => {
wrapEnabled
style={{
border: `1px solid ${theme.colors.grayscale.light2}`,
- background: theme.colors.secondary.light5,
- maxWidth: theme.gridUnit * 100,
+ background: theme.colorPrimaryBg,
+ maxWidth: theme.sizeUnit * 100,
Review Comment:
Same as my previous comment, and generally to all instances where sizeUnit
is used for dimensions instead of spacing.
--
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]