Skip to content

Commit

Permalink
[Darkside]: 🐛 Remove 'state'-tokens from new Box-component
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Dec 11, 2024
1 parent 601e156 commit f120708
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
5 changes: 2 additions & 3 deletions @navikt/core/react/src/layout/utilities/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Darkside tokens */
import { semanticTokenConfig } from "@navikt/ds-tokens/darkside/tokens/semantic";
import { SemanticTokensForAllRolesConfigT } from "@navikt/ds-tokens/darkside/tokens/semantic-roles";
import { StaticBgKeys } from "@navikt/ds-tokens/darkside/tokens/semantic-roles";
import { shadowTokenConfig } from "@navikt/ds-tokens/darkside/tokens/shadow";

/* Old */
Expand Down Expand Up @@ -45,8 +45,7 @@ export type SemanticStaticBgDarkside = keyof ReturnType<
typeof semanticTokenConfig
>["bg"];

export type SemanticRoleBgDarkside =
keyof SemanticTokensForAllRolesConfigT<"color">["bg"];
export type SemanticRoleBgDarkside = StaticBgKeys;

export type SemanticStaticBorderDarkside = keyof ReturnType<
typeof semanticTokenConfig
Expand Down
26 changes: 7 additions & 19 deletions @navikt/core/tokens/darkside/tokens/semantic-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import _ from "lodash";
import {
type ColorTheme,
type GlobalColorRoles,
StyleDictionaryToken,
type StyleDictionaryTokenConfig,
TokenTypes,
globalColorRoles,
} from "../util";

export type BgKeys =
export type StaticBgKeys =
| GlobalColorRoles
| `${GlobalColorRoles}-hover`
| `${GlobalColorRoles}-hoverA`
| `${GlobalColorRoles}-moderate`
| `${GlobalColorRoles}-moderateA`
| `${GlobalColorRoles}-strong`
| `${GlobalColorRoles}-raised`;

export type StateBgKeys =
| `${GlobalColorRoles}-hover`
| `${GlobalColorRoles}-hoverA`
| `${GlobalColorRoles}-moderate-hover`
| `${GlobalColorRoles}-moderate-hoverA`
| `${GlobalColorRoles}-moderate-pressed`
| `${GlobalColorRoles}-moderate-pressedA`
| `${GlobalColorRoles}-strong`
| `${GlobalColorRoles}-strong-hover`
| `${GlobalColorRoles}-strong-pressed`
| `${GlobalColorRoles}-raised`
| `${GlobalColorRoles}-raised-hover`;

export type TextKeys =
Expand All @@ -35,18 +35,6 @@ export type BorderKeys =
| `${GlobalColorRoles}-subtleA`
| `${GlobalColorRoles}-strong`;

export type SemanticTokensForAllRolesConfigT<T extends TokenTypes> = {
bg: {
[k in BgKeys]: Record<string, StyleDictionaryToken<T>>;
};
text: {
[k in TextKeys]: Record<string, StyleDictionaryToken<T>>;
};
border: {
[k in BorderKeys]: Record<string, StyleDictionaryToken<T>>;
};
};

const configForRole = (role: GlobalColorRoles, theme: ColorTheme) => {
return {
bg: {
Expand Down

0 comments on commit f120708

Please sign in to comment.