Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 59 additions & 62 deletions static/app/utils/theme/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,23 +444,6 @@ export type FormSize = 'xs' | 'sm' | 'md';

export type Space = keyof typeof space;

type FormTheme = {
form: Record<
FormSize,
{
borderRadius: string;
fontSize: string;
height: string;
lineHeight: string;
minHeight: string;
paddingBottom: number;
paddingLeft: number;
paddingRight: number;
paddingTop: number;
}
>;
};

const iconSizes: Record<Size, string> = {
xs: '12px',
sm: '14px',
Expand All @@ -484,6 +467,64 @@ const legacyTypography = {
},
} as const;

type FormTheme = {
form: Record<
FormSize,
{
borderRadius: string;
fontSize: string;
height: string;
lineHeight: string;
minHeight: string;
paddingBottom: number;
paddingLeft: number;
paddingRight: number;
paddingTop: number;
}
>;
};
const formTheme: FormTheme = {
/**
* Common styles for form inputs & buttons, separated by size.
* Should be used to ensure consistent sizing among form elements.
*/
form: {
md: {
height: '36px',
minHeight: '36px',
fontSize: '0.875rem',
lineHeight: '1rem',
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
borderRadius: radius.lg,
},
sm: {
height: '32px',
minHeight: '32px',
fontSize: '0.875rem',
lineHeight: '1rem',
paddingLeft: 12,
paddingRight: 12,
paddingTop: 8,
paddingBottom: 8,
borderRadius: radius.md,
},
xs: {
height: '28px',
minHeight: '28px',
fontSize: '0.75rem',
lineHeight: '1rem',
paddingLeft: 8,
paddingRight: 8,
paddingTop: 6,
paddingBottom: 6,
borderRadius: radius.sm,
},
},
};

/**
* Values shared between light and dark theme
*/
Expand Down Expand Up @@ -568,6 +609,7 @@ const commonTheme = {
borderRadius: '6px',
...legacyTypography,
...typography,
...formTheme,
};

export type Color = keyof ReturnType<typeof deprecatedColorMappings>;
Expand Down Expand Up @@ -967,48 +1009,6 @@ function makeChartColorPalette<T extends ChartColorPalette>(
};
}

const formTheme: FormTheme = {
/**
* Common styles for form inputs & buttons, separated by size.
* Should be used to ensure consistent sizing among form elements.
*/
form: {
md: {
height: '36px',
minHeight: '36px',
fontSize: '0.875rem',
lineHeight: '1rem',
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
borderRadius: radius.lg,
},
sm: {
height: '32px',
minHeight: '32px',
fontSize: '0.875rem',
lineHeight: '1rem',
paddingLeft: 12,
paddingRight: 12,
paddingTop: 8,
paddingBottom: 8,
borderRadius: radius.md,
},
xs: {
height: '28px',
minHeight: '28px',
fontSize: '0.75rem',
lineHeight: '1rem',
paddingLeft: 8,
paddingRight: 8,
paddingTop: 6,
paddingBottom: 6,
borderRadius: radius.sm,
},
},
};

// @TODO(jonasbadalic): eventually, we should port component usage to these values
function generateChonkTokens(colorScheme: typeof lightColors) {
return {
Expand Down Expand Up @@ -1631,8 +1631,6 @@ const lightThemeDefinition = {
type: 'light' as 'light' | 'dark',
// @TODO: color theme contains some colors (like chart color palette, diff, tag and level)
...commonTheme,

...formTheme,
...deprecatedColorMappings(lightColors),
...lightAliases,
...lightShadows,
Expand Down Expand Up @@ -1682,7 +1680,6 @@ export const darkTheme: SentryTheme = {
// @TODO: color theme contains some colors (like chart color palette, diff, tag and level)
...commonTheme,

...formTheme,
...deprecatedColorMappings(darkColors),
...darkAliases,
...darkShadows,
Expand Down
Loading