Skip to content
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

feat/tokenized-gradients: wip new gradient helper function #1071

Merged
merged 16 commits into from
Oct 15, 2024

Conversation

8coon
Copy link
Contributor

@8coon 8coon commented Sep 19, 2024

namedAlias() и gradient()

Добавил два алиаса для правильной разметки и компиляции градиентов в css и struct.json.

Документация

Добавил новый раздел в Github Pages с документацией по использованию токенов:

image

image

Также добавил документацию по существующим и новым хелпер-функциям:

image

@8coon 8coon marked this pull request as draft September 19, 2024 16:51
@8coon 8coon marked this pull request as ready for review September 25, 2024 17:21
@8coon 8coon requested a review from a team as a code owner September 25, 2024 17:21
Comment on lines +28 to +29
<div className="aside-menu-item" key={item.title}>
<Link to={`/articles/${item.slug}`}>{item.title}</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

а не хочешь выше сделать const {title} = item, че как редиска

Comment on lines 45 to 54
for (let i = 0; i < allLanguageEls.length; i++) {
const element = allLanguageEls[i];

if (element.getAttribute('data-language') === language) {
element.classList.add('code-tab-selected');
} else {
element.classList.remove('code-tab-selected');
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

forEach ?

Comment on lines 106 to 111
for (let i = 0; i < element.parentElement.children.length; i++) {
if (element.parentElement.children[i] === element) {
return i;
}
}

Copy link
Contributor

@Sarafa2n Sarafa2n Sep 25, 2024

Choose a reason for hiding this comment

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

findIndex ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Это NodeList. Функа вызывается в цикле, поэтому копирование элементов в массив только чтобы по нему сделать findIndex это уже перебор. Она не настолько большая и запутанная)

return;
}

const codeSelector = 'code.language-typescript, code.language-css, code.language-json';
Copy link
Contributor

Choose a reason for hiding this comment

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

а не хотим вынести это наверх как константу ?

Comment on lines 151 to 155
for (let i = 0; i < links.length; i++) {
const link = links[i] as HTMLElement;
link.setAttribute("target", "_blank");
}
}, [ref.current, articleContent]);
Copy link
Contributor

Choose a reason for hiding this comment

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

))

Comment on lines +25 to 30
for (const token of tokens) {
const tokenValue = copyDescription[token];

if (typeof tokenValue === 'function') {
copyDescription[token] = tokenValue(copyDescription);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ну дядь, тебя че на дз0 отправить ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ой иди ты) Можешь переписать этот кусок если так болит от for-of)))

Comment on lines +230 to +237
const result: T = {} as any;

for (const key of keys) {
const colors = source[key].split(', ');
result[key] = gradient(...colors);
}

return result;
Copy link
Contributor

@Sarafa2n Sarafa2n Sep 25, 2024

Choose a reason for hiding this comment

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

reduce ))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +18 to +33
{
title: "Темы",
},
{
slug: "new-theme",
title: "Создание новой темы для проекта",
contents: articleNewTheme,
},
{
title: "Токены",
},
{
slug: "token-helpers",
title: "Хелпер-функции",
contents: articleTokenHelpers,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

кмк спорно, я подумал бы над { title: string, topics: []} ошибиться в структуре меньше шансов

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Зато вложенную структуру рендерить сложнее, чем плоскую. Кажется что с двумя статьями смысла что-то сложное тут делать нет

Comment on lines 52 to 55
for (const key of keys) {
const rawPoints = cssGradients[key].split('%').slice(0, -1);
structGradients[key] = rawPoints.map(parseRawToken);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Нужно было написать парсер некоторых выражений css, но бюджет был 23 японских иены"

@8coon 8coon requested a review from Sarafa2n September 25, 2024 23:19
@qurle
Copy link
Contributor

qurle commented Sep 26, 2024

@8coon
Добавил новый раздел в Github Pages с документацией по использованию токенов:

Круто! А можно посмотреть где-нибудь?

Copy link
Contributor

@qurle qurle left a comment

Choose a reason for hiding this comment

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

Балдёж! Спасибо <3 <3 <3

@8coon 8coon merged commit 8a1be72 into qurle/feat/android-tokenized-gradients Oct 15, 2024
3 checks passed
@8coon 8coon mentioned this pull request Oct 16, 2024
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