From e1a6dcb7fab92ddbd808548550ba37f20068d5fa Mon Sep 17 00:00:00 2001 From: Esthefanie Vila Maior Date: Tue, 21 May 2024 22:39:42 +0100 Subject: [PATCH 1/2] feat: add typography types --- packages/system/src/typography/index.ts | 2 ++ packages/system/src/typography/types.ts | 28 +++++++++++++++++++ .../src/{ => typography}/typography.test.js | 0 .../typography.ts} | 6 ++-- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 packages/system/src/typography/index.ts create mode 100644 packages/system/src/typography/types.ts rename packages/system/src/{ => typography}/typography.test.js (100%) rename packages/system/src/{typography.js => typography/typography.ts} (91%) diff --git a/packages/system/src/typography/index.ts b/packages/system/src/typography/index.ts new file mode 100644 index 0000000000..2ad0a54163 --- /dev/null +++ b/packages/system/src/typography/index.ts @@ -0,0 +1,2 @@ +export * from './typography'; +export type { Typography } from './types'; diff --git a/packages/system/src/typography/types.ts b/packages/system/src/typography/types.ts new file mode 100644 index 0000000000..d43dd8f587 --- /dev/null +++ b/packages/system/src/typography/types.ts @@ -0,0 +1,28 @@ +import { colors, fontSizes, lineHeights } from '@gympass/yoga-tokens'; + +type ColorsValues = typeof colors | string; +type FontSizesValues = typeof fontSizes | string | number; +type LineHeightsValues = typeof lineHeights | string | number; +type TextAlignValues = string; + +type Color = { + color?: ColorsValues; + c?: ColorsValues; +}; + +type FontSize = { + fontSize?: FontSizesValues; + fs?: FontSizesValues; +}; + +type LineHeight = { + lineHeight?: LineHeightsValues; + lh?: LineHeightsValues; +}; + +type TextAlign = { + textAlign?: TextAlignValues; + ta?: TextAlignValues; +}; + +export type Typography = Color & FontSize & LineHeight & TextAlign; diff --git a/packages/system/src/typography.test.js b/packages/system/src/typography/typography.test.js similarity index 100% rename from packages/system/src/typography.test.js rename to packages/system/src/typography/typography.test.js diff --git a/packages/system/src/typography.js b/packages/system/src/typography/typography.ts similarity index 91% rename from packages/system/src/typography.js rename to packages/system/src/typography/typography.ts index 8b91415dd4..79306e850f 100644 --- a/packages/system/src/typography.js +++ b/packages/system/src/typography/typography.ts @@ -1,13 +1,13 @@ -import { toPx } from './unit'; +import { toPx } from '../unit'; import { getFontSize, getColor, getLineHeight, generator, compose, -} from './theme'; +} from '../theme'; -import { fontWeight } from './fontWeight'; +import { fontWeight } from '../fontWeight'; const color = props => generator({ From 39a7822bf54176b7da2bd12ee254a2f0731c6361 Mon Sep 17 00:00:00 2001 From: Esthefanie Vila Maior Date: Wed, 22 May 2024 12:05:52 +0100 Subject: [PATCH 2/2] test: change import --- packages/system/src/typography/typography.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/system/src/typography/typography.test.js b/packages/system/src/typography/typography.test.js index c7470a0de8..910984f3ed 100644 --- a/packages/system/src/typography/typography.test.js +++ b/packages/system/src/typography/typography.test.js @@ -9,7 +9,7 @@ import { textTransform, } from './typography'; -import { fontWeight as fontWeightAndroid } from './fontWeight.android'; +import { fontWeight as fontWeightAndroid } from '../fontWeight.android'; const fontSizes = [10, 20, 40];