chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
+30
-28
@@ -1,8 +1,8 @@
|
||||
import "./styles.css";
|
||||
import {
|
||||
type CSSVariablesResolver,
|
||||
colorsTuple,
|
||||
createTheme,
|
||||
type CSSVariablesResolver,
|
||||
getThemeColor,
|
||||
type MantinePrimaryShade,
|
||||
Modal,
|
||||
@@ -11,78 +11,80 @@ import {
|
||||
} from "@mantine/core";
|
||||
import designTokens from "@wealthledger/tokens/tokens.json";
|
||||
|
||||
const { color, typography, spacing, radius, shadows, breakpoints } =
|
||||
designTokens;
|
||||
const { breakpoints, color, radius, shadows, spacing, typography }
|
||||
= designTokens;
|
||||
const mapValues = <T, U>(values: Record<string, T>, convert: (value: T) => U) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(values).map(([name, value]) => [name, convert(value)]),
|
||||
);
|
||||
|
||||
const colorRoles = mapValues(color.roles, (role) =>
|
||||
const colorRoles = mapValues(color.roles, role =>
|
||||
role.shade === null ? role.color : `${role.color}.${role.shade}`,
|
||||
);
|
||||
|
||||
const theme = createTheme({
|
||||
respectReducedMotion: true,
|
||||
black: color.base.black,
|
||||
breakpoints: mapValues(
|
||||
breakpoints.values,
|
||||
value => `${value}${breakpoints.unit}`,
|
||||
),
|
||||
colors: mapValues(color.palettes, colorsTuple),
|
||||
components: {
|
||||
Modal: Modal.extend({
|
||||
defaultProps: {
|
||||
overlayProps: { blur: 3 },
|
||||
transitionProps: {
|
||||
transition: "fade-down",
|
||||
duration: 220,
|
||||
exitDuration: 180,
|
||||
timingFunction: "ease-out",
|
||||
transition: "fade-down",
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
primaryColor: color.roles.primary.color,
|
||||
primaryShade: color.primaryShade as MantinePrimaryShade,
|
||||
defaultRadius: radius.default,
|
||||
white: color.base.white,
|
||||
black: color.base.black,
|
||||
colors: mapValues(color.palettes, colorsTuple),
|
||||
fontFamily: typography.fontFamily,
|
||||
fontFamilyMonospace: typography.fontFamilyMonospace,
|
||||
fontSizes: mapValues(typography.fontSizes, (value) => rem(value)),
|
||||
fontSizes: mapValues(typography.fontSizes, value => rem(value)),
|
||||
fontWeights: mapValues(typography.fontWeights, String),
|
||||
lineHeights: mapValues(typography.lineHeights, String),
|
||||
headings: {
|
||||
fontFamily: typography.fontFamily,
|
||||
fontWeight: String(typography.fontWeights.bold),
|
||||
sizes: mapValues(typography.headings, (value) => ({
|
||||
sizes: mapValues(typography.headings, value => ({
|
||||
fontSize: rem(value.fontSize),
|
||||
lineHeight: String(value.lineHeight),
|
||||
})),
|
||||
},
|
||||
spacing: mapValues(spacing.values, (value) => rem(value)),
|
||||
radius: mapValues(radius.values, (value) => rem(value)),
|
||||
shadows: mapValues(shadows.values, (layers) =>
|
||||
lineHeights: mapValues(typography.lineHeights, String),
|
||||
primaryColor: color.roles.primary.color,
|
||||
primaryShade: color.primaryShade as MantinePrimaryShade,
|
||||
radius: mapValues(radius.values, value => rem(value)),
|
||||
respectReducedMotion: true,
|
||||
shadows: mapValues(shadows.values, layers =>
|
||||
layers
|
||||
.map(
|
||||
(layer) =>
|
||||
layer =>
|
||||
`${rem(layer.offsetX)} ${rem(layer.offsetY)} ${rem(layer.blur)} ${rem(layer.spread)} ${rgba(color.base[layer.color as keyof typeof color.base], layer.opacity)}`,
|
||||
)
|
||||
.join(", "),
|
||||
),
|
||||
breakpoints: mapValues(
|
||||
breakpoints.values,
|
||||
(value) => `${value}${breakpoints.unit}`,
|
||||
),
|
||||
spacing: mapValues(spacing.values, value => rem(value)),
|
||||
white: color.base.white,
|
||||
});
|
||||
|
||||
const cssVariablesResolver: CSSVariablesResolver = (resolvedTheme) => ({
|
||||
const cssVariablesResolver: CSSVariablesResolver = resolvedTheme => ({
|
||||
dark: {},
|
||||
light: {
|
||||
"--mantine-color-dimmed": getThemeColor(colorRoles.muted, resolvedTheme),
|
||||
},
|
||||
variables: Object.fromEntries(
|
||||
Object.entries(colorRoles).map(([role, reference]) => [
|
||||
`--wl-color-${role}`,
|
||||
getThemeColor(reference, resolvedTheme),
|
||||
]),
|
||||
),
|
||||
light: {
|
||||
"--mantine-color-dimmed": getThemeColor(colorRoles.muted, resolvedTheme),
|
||||
},
|
||||
dark: {},
|
||||
});
|
||||
|
||||
export { colorRoles, cssVariablesResolver, designTokens, theme };
|
||||
export { colorRoles, cssVariablesResolver, theme };
|
||||
|
||||
export { default as designTokens } from "@wealthledger/tokens/tokens.json";
|
||||
|
||||
Reference in New Issue
Block a user