Skip to content

Conversation

@AxyIX
Copy link
Collaborator

@AxyIX AxyIX commented Dec 17, 2025

No description provided.

};
}

presetTokens.semantic = { ...presetTokens.semantic, ...sizingBase };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как будто лучше избегать подобных мутаций

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

оригинальный объект нам не нужен. нас тут интересует только конечный набор токенов

Comment on lines 29 to 33
const semanticLink: any = presetTokens.semantic;

const sizingSmLink: any = sizingSm;
const sizingLgLink: any = sizingLg;
const sizingXlgLink: any = sizingXlg;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нормальная типизация?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

расписывать всё многообразие токенов не вижу смысла. их там прям много... в самом прайме типизация есть для этих штук, но она не экспортируется...

Comment on lines 35 to 51
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];
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants