VKUI icon indicating copy to clipboard operation
VKUI copied to clipboard

fix(Typography): add color style token

Open EldarMuhamethanov opened this issue 1 year ago • 6 comments

  • close #7072

  • [x] e2e-тесты

Описание

У компонентов Typoghraphy не был установлен стиль color. Поэтому при смене темы не менялся цвет текста

Изменения

Добавил prop colorType с двумя типами:

  • inherit. Означает, что цвет наследуется от родителя. Нужен для того, чтобы не ломать обратную совместимость с прошлыми версиями(если у кого-то уже цвет зависит от родителей)
  • primary. Добавляет стиль color: var(--vkui--color_text_primary)

UPD

Изменения в реализации:

  • props colorType не будет
  • Необходимые стили теперь прокидываются через TokensClassProvider

EldarMuhamethanov avatar Jun 27 '24 10:06 EldarMuhamethanov

size-limit report 📦

Path Size
JS 368.69 KB (+0.02% 🔺)
JS (gzip) 112.88 KB (+0.02% 🔺)
JS (brotli) 92.88 KB (+0.02% 🔺)
JS import Div (tree shaking) 1.42 KB (0%)
CSS 289.96 KB (+0.04% 🔺)
CSS (gzip) 37.7 KB (+0.12% 🔺)
CSS (brotli) 30.46 KB (+0.05% 🔺)

github-actions[bot] avatar Jun 27 '24 10:06 github-actions[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Jun 27 '24 10:06 codesandbox-ci[bot]

e2e tests

Playwright Report

github-actions[bot] avatar Jun 27 '24 10:06 github-actions[bot]

👀 Docs deployed

Commit 15cc46116140e478b1c013d20526bcdbed63d4a4

github-actions[bot] avatar Jun 27 '24 10:06 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.89%. Comparing base (3f408a7) to head (15cc461).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7090   +/-   ##
=======================================
  Coverage   83.89%   83.89%           
=======================================
  Files         357      357           
  Lines       10776    10776           
  Branches     3553     3553           
=======================================
  Hits         9041     9041           
  Misses       1735     1735           
Flag Coverage Δ
unittests 83.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 27 '24 10:06 codecov[bot]

Для решения задачи нужно в TokensClassProvider докинуть класс который бы навешивал класс с стилями:

  color-scheme: var(--vkui--colors_scheme);
  color: var(--vkui--color_text_primary);

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

SevereCloud avatar Jun 27 '24 13:06 SevereCloud