feat(tokens): Make colors from tokens.ts reusable my setting ColorTokens type

This commit is contained in:
Emil Ivanichkov 2024-02-09 20:09:10 +02:00 committed by Emil Ivanichkov
parent d86f6307a8
commit 82884cbf67

View File

@ -1,6 +1,11 @@
import { customisation } from '@status-im/colors'
import { createTokens } from '@tamagui/core'
import { size, space, zIndex } from '@tamagui/theme-base'
import { size, space, zIndex } from '@tamagui/themes'
import { ColorTokens } from 'tamagui';
type ColorObject = {
[key: string]: ColorTokens;
}
export const tokens = createTokens({
color: {
@ -200,6 +205,9 @@ export const tokens = createTokens({
},
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const colorsTyped: ColorObject = tokens.color as { [key: string]: any };
type GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`
type RadiusTokens = GetTokenString<keyof typeof tokens.radius> | number