Skip to content

Feat/62386070 showcase page#20

Open
oostap1985 wants to merge 6 commits intomlutcss:mainfrom
oostap1985:feat/62386070_showcase-page
Open

Feat/62386070 showcase page#20
oostap1985 wants to merge 6 commits intomlutcss:mainfrom
oostap1985:feat/62386070_showcase-page

Conversation

@oostap1985
Copy link
Copy Markdown

No description provided.

Oleg Ostapchuk added 2 commits March 30, 2026 17:41
- add hover-slider library
- update JSON data for showcase items
- fix mlut utilities
Comment thread src/_data/cases.json Outdated
Comment thread src/_includes/components/show-card-slider.ejs Outdated
Comment thread src/_includes/components/show-card.ejs Outdated
Comment thread src/_includes/components/show-card-slider.ejs Outdated
Comment thread src/assets/script/slider.js Outdated
}

const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/gh/web-projects-lab/[email protected]/hover-slider.min.js';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Стороннюю библиотеку надо импортировать как es-модуль тут, а не как скрипт на страницу подключать

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Если я правильно понял и не ошибаюсь, ее нельзя импортировать через import ... from '...' (https://github.com/web-projects-lab/hover-slider/blob/master/README.md)

Comment thread src/assets/style/style.scss Outdated
Comment thread src/layouts/base.ejs Outdated
Comment thread src/showcase.ejs Outdated
Comment thread src/showcase.ejs Outdated
-add buttons  -fix styles
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Зачем в названии каталога images, если по верхнему каталогу и так понятно, что тут изображения?

alt=""
class="W100p H100p Ojf-cv Ojp-c Bdrd8 hover-switch-image"
/>
<button id="back" class="D-f P1u Bgc-$blueGray Bd-n Bdrd8 Ps-a T119 L16 md_D-n">
Copy link
Copy Markdown
Contributor

@mr150 mr150 Apr 11, 2026

Choose a reason for hiding this comment

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

При подключении компонента получится много элементов с одинаковым id на странице - такого быть не должно. Обычные классы для нужд js никто не запрещал использовать или data атрибуты

%>

<<%= tag %>>
<a class="Txd-n C-ih W100p H100p D-f Fld-c Bdt1;s;$accent750 Bdb1;s;$accent750 Bdt1;s;$brand_h Bdb1;s;$brand_h Ts-bd,0.3s,e Cs" href="<%= item.link %>">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Зачем 2 утилиты для разных сторон бордера, если есть одна: -Bdy?

Comment thread src/assets/script/slider.js Outdated
@@ -0,0 +1,79 @@
const libraryJs = "https://cdn.jsdelivr.net/gh/web-projects-lab/[email protected]/hover-slider.min.js";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread src/showcase.ejs Outdated
<div class="D-n H8u W-$bleedWidth Ml-140 Bdt1;s;$accent750 Bdb1;s;$accent750 md_D-f"></div>
<ul class="Lss-n P0 M8u;5u D-g Gtc-t1 Gap8u sm_Gtc-t2 xl_Gtc-t3 xxl_Gtc-t4">
<% for (let elem of it.cases) { %>
<%- include('_includes/components/show-card-slider.ejs', { optTag: 'li', item: elem }) %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Если по дефолту тег li, то и параметр этот передавать нет смысла

src="<%= defaultImage %>"
alt="<%= item.title %>"
data-hover-slides="<%= othersImages %>"
data-options='{"touch": "end", "infinite": false, "preventScroll": true}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Если эти опции статичны, то почему они тут передаются, а не сразу в js указаны?

- add new library
- fix mlut utilities
Comment thread src/assets/script/swiper.js Outdated

async loadSwiperModule() {
try {
const { default: Swiper } = await import(swiperModule);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Почему динамический импорт, а не обычный?

Comment thread src/assets/script/swiper.js Outdated
this.loadSwiperModule();
}

render() {
Copy link
Copy Markdown
Contributor

@mr150 mr150 Apr 15, 2026

Choose a reason for hiding this comment

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

Зачем тут рендеринг? Этот компонент легковесный должен быть, просто инкапсулировать логику. Предыдущий вариант в этом плане был лучше - не понятно, для чего сюда разметка переместилась

Comment thread src/assets/script/swiper.js Outdated
}

ensureStyles() {
if (document.querySelector(`link[href*="swiper-bundle.min.css"]`)) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Если уж CSS подключать в этом модуле, то не в методах компонента, а просто в скрипте 1 раз

Comment thread src/showcase.ejs
---

<%
const bdX = "-Bdx -Bdxc-$accent750";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Зачем тут 2 утилиты если можно цвет сразу в -Bdx/-Bdy указать, как и просто в Bd

</div>
<% }); %>
<% } else { %>
<div class="swiper-slide">Нет изображений</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Все тексты на английском

</div>
<div class="swiper-pagination"></div>
<button class="prev D-f P1u Bg-n Bd-n Bdrd8 Ps-a T109 L0 Zi1 md_D-n">
<svg class="Fi-$gray200 Fi-$brand_a Ts-shortTs Tf -Rt180d Cs" width="26px" height="26px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Для svg иконок надо использовать svg спрайты. Примеры есть на сайте, можно даже существующий спрайт расширить

</svg>
</button>
<button class="next D-f P1u Bg-n Bd-n Bdrd8 Ps-a T109 R0 Zi1 md_D-n">
<svg class="Fi-$gray200 Fi-$brand_a Ts-$shortTs Cs" width="26px" height="26px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
Copy link
Copy Markdown
Contributor

@mr150 mr150 Apr 22, 2026

Choose a reason for hiding this comment

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

Зачем тут $shortTs, используй везде дефолтный

Comment thread src/assets/script/swiper.js Outdated
}

initSwiper() {
if (!this.isConnected) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Это уже не нужно

Comment thread src/assets/script/swiper.js Outdated
}

connectedCallback() {
this.initSwiper();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Отдельный метод уже не нужен

<button class="prev D-f P1u Bg-n Bd-n Bdrd8 Ps-a T109 L0 Zi1 md_D-n">
<svg class="Fi-$gray200 Fi-$brand_a Ts-shortTs Tf -Rt180d Cs" width="26px" height="26px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<polygon points="150.46 478 129.86 456.5 339.11 256 129.86 55.49 150.46 34 382.14 256 150.46 478"/>
<svg class="W26 H26 Fi-$gray200 Fi-$brand_a Ts-fi,0.3s,e Tf -Rt180d Cs">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Для transition по дефолту лучше вот эту утилиту использовать

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Размеры у svg лучше атрибутами задвать, как у обычного img

@mr150
Copy link
Copy Markdown
Contributor

mr150 commented Apr 25, 2026

На десктопе навигация в фото-виджете должна появляться только при наведении

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants