Skip to content

Commit

Permalink
feat: Removed legacy theme structure
Browse files Browse the repository at this point in the history
  • Loading branch information
tft-abel committed Nov 22, 2024
1 parent 22dfced commit f33d921
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 286 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const nextConfig = {
webpack(config) {
config.resolve.alias = {
...config.resolve.alias,
'@atb/theme/theme.css': `@atb-as/theme/lib/generated/themes-fs/${orgId}-theme/theme.css`,
'@atb/theme/theme.css': `@atb-as/theme/lib/generated/themes/${orgId}-theme/theme.css`,
'@atb/theme/typography.css': '@atb-as/theme/lib/generated/typography.css',
'@atb/theme/typography.module.css':
'@atb-as/theme/lib/generated/typography.module.css',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@apollo/client": "^3.11.2",
"@atb-as/config-specs": "^3.27.0",
"@atb-as/theme": "^11.1.1",
"@atb-as/theme": "./../../design-system/packages/theme",
"@github/combobox-nav": "^3.0.1",
"@internationalized/date": "^3.5.5",
"@isaacs/ttlcache": "^1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion public/widget/C4Jw9gtgzkA/2.27.0/planner-web.css

Large diffs are not rendered by default.

477 changes: 237 additions & 240 deletions public/widget/C4Jw9gtgzkA/2.27.0/planner-web.mjs

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions public/widget/C4Jw9gtgzkA/2.27.0/planner-web.umd.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/components/icon/mono-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MonoIcons, icons } from './generated-icons';
import { SizeProps, useSize } from './utils';
import { InteractiveColor, InteractiveState, TextColorName, useDarkMode } from '@atb/modules/theme';
import { InteractiveColor, InteractiveState, TextColorType, useDarkMode } from '@atb/modules/theme';
import { colorToOverrideMode } from '@atb/utils/color';

export type { SizeProps };
Expand Down Expand Up @@ -58,13 +58,13 @@ export function MonoIcon({

export default MonoIcon;

function insertMode(relative: string, mode: TextColorName) {
function insertMode(relative: string, mode: TextColorType) {
return relative.replace('mono/', `mono/${mode}/`);
}

function colorToMode(
color: MonoIconProps['overrideMode'],
): TextColorName | undefined {
): TextColorType | undefined {
if (color == 'none') return undefined;
return color == 'dark' ? 'dark' : 'light';
}
Expand Down
36 changes: 10 additions & 26 deletions src/modules/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
import { ContrastColorFs, createThemesFor, ThemeFs, ThemeVariant, InteractiveColor as _InteractiveColor, TransportColor as _TransportColor, StatusColor as _StatusColor } from '@atb-as/theme';
import { createThemesFor, ThemeVariant } from '@atb-as/theme';
import { useDarkmodeCookie } from '@atb/modules/cookies';
import { currentOrg, WEBSHOP_ORGS } from '@atb/modules/org-data';
import { useEffect } from 'react';

export type Theme = ThemeFs
export type ContrastColor = ContrastColorFs
export type {
InteractiveColor,
InteractiveState,
StatusColorName,
TransportColors,
ContrastColor,
TextColorType,
} from '@atb-as/theme'

export type TextColorName = keyof Theme['color']['foreground']

export type InteractiveColor = _InteractiveColor<ContrastColor>
export type InteractiveColorName = keyof Theme['color']['interactive']
export type InteractiveColors = Theme['color']['interactive']
export type InteractiveState = keyof InteractiveColor

export type TransportColor = _TransportColor<ContrastColor>
export type TransportColorName = keyof Theme['color']['transport']
export type TransportColors = Theme['color']['transport']
export type TransportColorState = keyof Theme['color']['transport']['city']

export type BackgroundColors = Theme['color']['background']
export type BackgroundColorName = keyof Theme['color']['background']
export type BackgroundColorState<T extends BackgroundColorName> = keyof Theme['color']['background'][T]

export type StatusColor = _StatusColor<ContrastColor>
export type StatusColorName = keyof Theme['color']['status']
export type StatusColors = Theme['color']['status']

export const theme = createThemesFor(getThemeVariant(currentOrg), {
useFigmaStructure: true
});
export const theme = createThemesFor(getThemeVariant(currentOrg));

function getThemeVariant(orgId: WEBSHOP_ORGS): ThemeVariant {
switch (orgId) {
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
normalize-path "^3.0.0"
stream-editor "^1.11.0"

"@atb-as/theme@./../../design-system/packages/theme":
version "11.1.2"
dependencies:
"@tfk-samf/figma-to-dtcg" "0.4.0"
hex-to-rgba "^2.0.1"
ts-deepmerge "^4.0.0"

"@atb-as/theme@^11.1.1":
version "11.1.1"
resolved "https://registry.yarnpkg.com/@atb-as/theme/-/theme-11.1.1.tgz#5fabede8c0fcb47af8d0f19ab99af1f96c27a910"
Expand Down

0 comments on commit f33d921

Please sign in to comment.