-
Notifications
You must be signed in to change notification settings - Fork 197
feat(SubnavigationBar): add prop withFade #9116
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(SubnavigationBar): add prop withFade #9116
Conversation
e2e tests |
👀 Docs deployed
📦 Package ✅yarn add @vkontakte/vkui@https://vkui-screenshot.hb.bizmrg.com/pull/9116/3dfe9d77078d1cce6dff94156d3491661ee149ff/pkg/@vkontakte/vkui/_pkg.tgzCommit 3dfe9d7 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9116 +/- ##
==========================================
- Coverage 95.96% 95.89% -0.07%
==========================================
Files 455 455
Lines 26525 26562 +37
Branches 4923 4927 +4
==========================================
+ Hits 25454 25471 +17
- Misses 1071 1091 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| .inFadeLeft { | ||
| mask-image: linear-gradient(to left, rgb(0, 0, 0, 1) 90%, rgb(0, 0, 0, 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.
mask-image (см. https://caniuse.com/?search=mask-image), к сожалению, поддерживается только в современных браузерах
Если говорить о том, что это фича будет только для современных браузеров (a.k.a Graceful Degaration), то нужно сделать без лишних обёрток. Нужно будет доработать HorizontalScroll, чтобы можно было передавать класс туда, где сейчас styles.in.
И тогда всё будет очень просто:
<ScrollWrapper contentInClassName={style.inFade} />.inFade {
mask-image: linear-gradient(to right, transparent 0, black 20px, black calc(100% - 20px), transparent 100%);
mask-repeat: no-repeat;
mask-size: 100% 100%;
}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.
В любом случае, я бы это сделал через текущую структуру на основе HorizontalScroll, без создания новой
Нам градиент прям большой нужен? Если делать размером в var(--vkui--size_base_padding_horizontal--regular) (оступы по бокам), то нет необходимости делать лишние вычисления
.inFade {
mask-image: linear-gradient(to right, transparent 0, black var(--vkui--size_base_padding_horizontal--regular), black calc(100% - var(--vkui--size_base_padding_horizontal--regular)), transparent 100%);
mask-repeat: no-repeat;
mask-size: 100% 100%;
}И всё, весь PR будет состоять только из styles.inFade и свойства withFade (хотя подумаю как иначе переименовать, на более семантичное)
Вот демо
2025-10-31.15.39.25.mov
|
Решили отложить добавление fade в компонент – нужно для начала утвердить этот паттерн в дизайн-системе |
Описание
Добавить затенение по краям контейнера при горизонтальной прокрутке содержимого
Изменения
withFade, которой позволяет отображать или скрывать затенение по краям контейнера при горизонтальной прокрутке содержимого