-
Notifications
You must be signed in to change notification settings - Fork 0
DS-195 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/DS-187
Are you sure you want to change the base?
DS-195 #8
Conversation
| }; | ||
| } | ||
|
|
||
| presetTokens.semantic = { ...presetTokens.semantic, ...sizingBase }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как будто лучше избегать подобных мутаций
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
оригинальный объект нам не нужен. нас тут интересует только конечный набор токенов
src/prime-preset/map-tokens.ts
Outdated
| const semanticLink: any = presetTokens.semantic; | ||
|
|
||
| const sizingSmLink: any = sizingSm; | ||
| const sizingLgLink: any = sizingLg; | ||
| const sizingXlgLink: any = sizingXlg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нормальная типизация?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
расписывать всё многообразие токенов не вижу смысла. их там прям много... в самом прайме типизация есть для этих штук, но она не экспортируется...
src/prime-preset/map-tokens.ts
Outdated
| for (const key in sizingSm) { | ||
| if ((semanticLink)[key]) { | ||
| semanticLink[key].sm = sizingSmLink[key]?.root ? sizingSmLink[key].root : sizingSmLink[key]; | ||
| } | ||
| } | ||
|
|
||
| for (const key in sizingLg) { | ||
| if ((semanticLink)[key]) { | ||
| semanticLink[key].lg = sizingLgLink[key]?.root ? sizingLgLink[key].root : sizingLgLink[key]; | ||
| } | ||
| } | ||
|
|
||
| for (const key in sizingXlg) { | ||
| if ((semanticLink)[key]) { | ||
| semanticLink[key].xlg = sizingXlgLink[key]?.root ? sizingXlgLink[key].root : sizingXlgLink[key]; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for (const key in sizingSm) { | |
| if ((semanticLink)[key]) { | |
| semanticLink[key].sm = sizingSmLink[key]?.root ? sizingSmLink[key].root : sizingSmLink[key]; | |
| } | |
| } | |
| for (const key in sizingLg) { | |
| if ((semanticLink)[key]) { | |
| semanticLink[key].lg = sizingLgLink[key]?.root ? sizingLgLink[key].root : sizingLgLink[key]; | |
| } | |
| } | |
| for (const key in sizingXlg) { | |
| if ((semanticLink)[key]) { | |
| semanticLink[key].xlg = sizingXlgLink[key]?.root ? sizingXlgLink[key].root : sizingXlgLink[key]; | |
| } | |
| } | |
| function applySizing( | |
| semantic: SemanticTokens, | |
| sizing: Record<string, any>, | |
| sizeKey: 'sm' | 'lg' | 'xlg' | |
| ) { | |
| Object.keys(sizing).forEach(key => { | |
| if (semantic[key]) { | |
| semantic[key][sizeKey] = | |
| sizing[key]?.root ?? sizing[key]; | |
| } | |
| }); | |
| }); | |
| for (const key in sizing) { | |
| if (semantic[key]) { | |
| semantic[key][sizeKey] = | |
| sizing[key]?.root ?? sizing[key]; | |
| } | |
| } | |
| } | |
| applySizing(semanticLink, sizingSm, 'sm'); | |
| applySizing(semanticLink, sizingLg, 'lg'); | |
| applySizing(semanticLink, sizingXlg, 'xlg'); |
No description provided.