-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat/tokenized-gradients: wip new gradient helper function #1071
Conversation
<div className="aside-menu-item" key={item.title}> | ||
<Link to={`/articles/${item.slug}`}>{item.title}</Link> |
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.
а не хочешь выше сделать const {title} = item, че как редиска
docs/src/pages/Articles.tsx
Outdated
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'); | ||
} | ||
} | ||
} |
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.
forEach ?
docs/src/pages/Articles.tsx
Outdated
for (let i = 0; i < element.parentElement.children.length; i++) { | ||
if (element.parentElement.children[i] === element) { | ||
return i; | ||
} | ||
} | ||
|
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.
findIndex ??
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.
Это NodeList. Функа вызывается в цикле, поэтому копирование элементов в массив только чтобы по нему сделать findIndex это уже перебор. Она не настолько большая и запутанная)
docs/src/pages/Articles.tsx
Outdated
return; | ||
} | ||
|
||
const codeSelector = 'code.language-typescript, code.language-css, code.language-json'; |
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.
а не хотим вынести это наверх как константу ?
docs/src/pages/Articles.tsx
Outdated
for (let i = 0; i < links.length; i++) { | ||
const link = links[i] as HTMLElement; | ||
link.setAttribute("target", "_blank"); | ||
} | ||
}, [ref.current, articleContent]); |
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 token of tokens) { | ||
const tokenValue = copyDescription[token]; | ||
|
||
if (typeof tokenValue === 'function') { | ||
copyDescription[token] = tokenValue(copyDescription); | ||
} |
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.
ну дядь, тебя че на дз0 отправить ?
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-of)))
const result: T = {} as any; | ||
|
||
for (const key of keys) { | ||
const colors = source[key].split(', '); | ||
result[key] = gradient(...colors); | ||
} | ||
|
||
return result; |
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.
reduce ))
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.
{ | ||
title: "Темы", | ||
}, | ||
{ | ||
slug: "new-theme", | ||
title: "Создание новой темы для проекта", | ||
contents: articleNewTheme, | ||
}, | ||
{ | ||
title: "Токены", | ||
}, | ||
{ | ||
slug: "token-helpers", | ||
title: "Хелпер-функции", | ||
contents: articleTokenHelpers, | ||
}, |
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.
кмк спорно, я подумал бы над { title: string, topics: []} ошибиться в структуре меньше шансов
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 of keys) { | ||
const rawPoints = cssGradients[key].split('%').slice(0, -1); | ||
structGradients[key] = rawPoints.map(parseRawToken); | ||
} |
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.
"Нужно было написать парсер некоторых выражений css, но бюджет был 23 японских иены"
Круто! А можно посмотреть где-нибудь? |
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.
Балдёж! Спасибо <3 <3 <3
8a1be72
into
qurle/feat/android-tokenized-gradients
namedAlias() и gradient()
Добавил два алиаса для правильной разметки и компиляции градиентов в css и struct.json.
Документация
Добавил новый раздел в Github Pages с документацией по использованию токенов:
Также добавил документацию по существующим и новым хелпер-функциям: