This project migrates SCSS tokens and mixins into a coherent styled-components setup while keeping parity with the original design language.
- Global CSS variables mirroring SCSS tokens (spacing, colors, typography)
- Global font-face declarations for Poppins (body) and Montserrat (headings)
- A
lighttheme that can be applied dynamically - TypeScript helpers that replicate SCSS mixins and tokens
-
Global variables:
src/ui/styles/base.ts- Declares CSS variables on
htmlfor:- Spacings:
--space, --space-x2, ... - Colors:
--color-primary, --color-dark, ... - Typography tokens:
--font-heading, --font-body, --weight-*
- Spacings:
- Exposes JS helpers via
cssVariableswith SCSS-like aliases.
- Declares CSS variables on
-
Fonts:
src/ui/styles/fonts.tsGlobalFontsinjects @font-face for Poppins and Montserrat- Defines
--font-bodyand--font-headingvariables
-
SCSS Tokens in TS:
src/ui/styles/scssTokens.tsspacing,colors,fonts,weightsfontSize(px)– equivalent to@include font-size($size)getOpacity(color, amount)– equivalent toget-opacity($color, $amount)scssMedia– equivalents forvendors/breakpoints.scss
-
Themes:
src/ui/styles/theme.tsthemes.light– light palette bound to CSS variablesthemeUtils.applyTheme(name)– applies theme variables to:root
In src/ui/App.tsx, the light theme is applied by default:
useEffect(() => {
themeUtils.applyTheme('light');
}, []);To switch theme at runtime:
import { themeUtils } from '@/ui/styles/theme';
themeUtils.applyTheme('space'); // or 'neon', 'ocean', 'forest', 'light'- Spacings (parity with SCSS):
import styled from 'styled-components';
import { cssVariables } from '@/ui/styles/base';
export const Box = styled.div`
padding: ${cssVariables.spacing.space_x2};
margin-top: ${cssVariables.spacing.space};
`;- Colors (parity with SCSS):
import styled from 'styled-components';
import { cssVariables } from '@/ui/styles/base';
export const Title = styled.h1`
color: ${cssVariables.scssColors.color_dark};
`;- Typography + mixins:
import styled from 'styled-components';
import { fontSize } from '@/ui/styles/scssTokens';
export const Heading = styled.h1`
font-family: var(--font-heading);
${fontSize(30)}
font-weight: var(--weight-bolder);
`;- Breakpoints (SCSS vendor parity):
import styled from 'styled-components';
import { scssMedia } from '@/ui/styles/scssTokens';
export const Grid = styled.div`
display: grid;
grid-template-columns: 1fr;
${scssMedia.tablet} {
grid-template-columns: 1fr 1fr;
}
${scssMedia['desktop-m']} {
grid-template-columns: repeat(3, 1fr);
}
`;- For best performance, prefer WOFF2 formats for fonts if available.
- You can make
var(--font-body)the default inGlobalStyles(already applied) and usevar(--font-heading)for headings. - If you want to remove SCSS entirely, remove unused imports from
src/ui/assets/scss/index.scssonce the migration is complete.