Skip to content

Conversation

@fm-designer
Copy link
Contributor

Описание

Добавить затенение по краям контейнера при горизонтальной прокрутке содержимого

Изменения

  • Добавлен prop withFade, которой позволяет отображать или скрывать затенение по краям контейнера при горизонтальной прокрутке содержимого
  • Доработаны стили комопнента для отображения затенения

@fm-designer fm-designer requested a review from a team as a code owner October 30, 2025 12:47
@github-actions
Copy link
Contributor

e2e tests

Playwright Report

@github-actions
Copy link
Contributor

📊 Найдены изменения в собранных файлах: Отчет

Commit 3dfe9d7

@github-actions
Copy link
Contributor

👀 Docs deployed

📦 Package ✅

yarn add @vkontakte/vkui@https://vkui-screenshot.hb.bizmrg.com/pull/9116/3dfe9d77078d1cce6dff94156d3491661ee149ff/pkg/@vkontakte/vkui/_pkg.tgz

Commit 3dfe9d7

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 57.89474% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.89%. Comparing base (9101b62) to head (3dfe9d7).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...c/components/SubnavigationBar/SubnavigationBar.tsx 57.89% 16 Missing ⚠️
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     
Flag Coverage Δ
unittests 95.89% <57.89%> (-0.07%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

.inFadeLeft {
mask-image: linear-gradient(to left, rgb(0, 0, 0, 1) 90%, rgb(0, 0, 0, 0));
Copy link
Contributor

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%;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Нам нужно несколько классов, для того чтобы отображать тень. Так как в зависисмости от позиции прокрутки, тень может быть:

  • только слева
  • только справа
  • слева и справа

Copy link
Contributor

@inomdzhon inomdzhon Oct 31, 2025

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

@SevereCloud SevereCloud changed the title add prop withFade feat(SubnavigationBar): add prop withFade Oct 31, 2025
@SevereCloud SevereCloud added this to VKUI Oct 31, 2025
@SevereCloud SevereCloud added this to the v7.10.0 milestone Oct 31, 2025
@SevereCloud SevereCloud moved this to 👀 In Review in VKUI Oct 31, 2025
@SevereCloud SevereCloud moved this from 👀 In Review to 🔧 In progress in VKUI Oct 31, 2025
@inomdzhon inomdzhon removed this from the v7.10.0 milestone Nov 5, 2025
@inomdzhon inomdzhon marked this pull request as draft November 5, 2025 10:36
@vkcom-publisher vkcom-publisher added the pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности label Nov 13, 2025
@inomdzhon
Copy link
Contributor

Решили отложить добавление fade в компонент – нужно для начала утвердить этот паттерн в дизайн-системе

@inomdzhon inomdzhon closed this Nov 13, 2025
@github-project-automation github-project-automation bot moved this from 🔧 In progress to ✅ Done in VKUI Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmp:subnavigation-bar pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants