Skip to content

feat(alert,visual): theming with CSS variables (#DS-2679) #208

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

Merged
merged 16 commits into from
Sep 5, 2024

Conversation

NikGurev
Copy link
Contributor

@NikGurev NikGurev commented Aug 14, 2024

Summary

Now using components is easier! We are moving towards complete component isolation, which will allow you to easily connect and use them. In addition, we have removed the need to pass tokens for assigning colors to components.

List of notable changes:

  • added script for generation css tokens for separate component.
  • updated typography and theme colors injection - used in componenst styles instead of general theme.
  • removed $theme and $config param from component theme mixins. Only css variables used. In that case, default values are expected to be initialized (via css files from @koobiq/design-tokens or on your own)

Styles for each component

CSS file structure:

// size, fonts
.kbq-<component-name> {
}

// styles for light theme
:where(.kbq-light, .theme-light, .kbq-theme-light) {}
// styles for dark theme
:where(.kbq-dark, .theme-dark, .kbq-theme-dark) {}

Q&A

if I want to change something in the alert, how will I do it?

You can change colors, sizes, and fonts by setting appropriate values for the component's CSS variables.

will something need to be changed in order to be applied correctly?

Simply add the class kbq-light to the element of your HTML document for using a light theme and kbq-dark for a dark theme.

Otherwise, you don't need to add anything, css variables are connected together with the component.

What's next?
We plan to apply these improvements to all components and use semantic values for the CSS variables of components, such as var(--kbq-size-m) instead of 12px. This will make the code more readable and maintainable.

Описание на RU Теперь использование компонентов стало проще! Мы движемся к полной изоляции компонентов, что позволит вам легко подключать и использовать их. Кроме того, мы убрали необходимость пробрасывать токены для задания цветов компонентам.
  • добавлен скрипт для генерации css-токенов для отдельного компонента.
  • обновлено использование типографики и тематических цветов - используется в стилях компонента вместо общей темы.
  • удален параметр $theme и $config из миксинов темы компонента. Использованы только переменные css.

Q&A

если захочу поменять, что-то в алерте, то как это получится сделать?

Изменить цвета, размеры и шрифты можно задав соответствующие значения css-переменным компонента.

нужно ли будет что-то поправить, чтобы применилось корректно?

Просто добавьте класс kbq-light к элементу вашего HTML-документа для использования светлой темы и kbq-dark для темной темы.

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

Что планируется сделать дальше?
Мы планируем применить эти улучшения ко всем компонентам и использовать семантические значения для CSS-переменных компонентов, такие как var(--kbq-size-m) вместо 12px. Это сделает код более читаемым и поддерживаемым.

@NikGurev NikGurev added the enhancement New feature or request label Aug 14, 2024
@NikGurev NikGurev self-assigned this Aug 14, 2024
@NikGurev NikGurev changed the title feat(visual): theming with CSS variables (#DS-2679) WIP feat(visual): theming with CSS variables (#DS-2679) Aug 14, 2024
@NikGurev NikGurev force-pushed the feat/DS-2679 branch 2 times, most recently from 8242d14 to 4efdcd7 Compare August 26, 2024 10:47
Copy link

github-actions bot commented Aug 26, 2024

Visit the preview URL for this PR (updated for commit 84d6ac9):

https://koobiq-next--prs-208-fyhv77e8.web.app

(expires Tue, 10 Sep 2024 09:54:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c

@NikGurev NikGurev marked this pull request as ready for review September 2, 2024 09:08
@NikGurev NikGurev requested a review from artembelik September 2, 2024 13:18
@NikGurev NikGurev force-pushed the feat/DS-2679 branch 2 times, most recently from 052a303 to 886e33e Compare September 3, 2024 15:10
@NikGurev NikGurev requested a review from pimenovoleg September 4, 2024 07:37
@NikGurev NikGurev merged commit fe332ad into main Sep 5, 2024
3 checks passed
@NikGurev NikGurev deleted the feat/DS-2679 branch September 5, 2024 12:44
@NikGurev NikGurev changed the title feat(visual): theming with CSS variables (#DS-2679) feat(alert,visual): theming with CSS variables (#DS-2679) Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants