-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/62386070 showcase page #20
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
Open
oostap1985
wants to merge
4
commits into
mlutcss:main
Choose a base branch
from
oostap1985:feat/62386070_showcase-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| [ | ||
| { | ||
| "title": "John Smith", | ||
| "images": ["/assets/img/imagesCases/Emily_Blunt-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Все, что человеческий разум способен понять и во что он способен поверить, достижимо.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Emily Blunt", | ||
| "images": ["/assets/img/imagesCases/John_Smith-new.jpg", "/assets/img/imagesCases/Emily_Blunt-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Сложнее всего начать действовать, все остальное зависит только от упорства.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Koshak Koteevich", | ||
| "images": ["/assets/img/imagesCases/Tigra_Leopardovich.jpg", "/assets/img/imagesCases/Emily_Blunt-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Неудача — это возможность начать заново, но уже более мудро.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Luna Lovegood", | ||
| "images": ["/assets/img/imagesCases/orange-wood-table.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Если проблему можно решить, не стоит о ней беспокоиться.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Milana Clark", | ||
| "images": ["/assets/img/imagesCases/Panda_Padlovna.jpg", "/assets/img/imagesCases/orange-wood-table.jpg", "/assets/img/imagesCases/Emily_Blunt-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Обстоятельства часто можно изменить, изменив свое отношение к ним.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Leopardovskiy Orange Apelsinovich", | ||
| "images": ["/assets/img/imagesCases/Koshak_Koteevich.jpg", "/assets/img/imagesCases/Emily_Blunt-new.jpg"], | ||
| "description": "Обстоятельства часто можно изменить, изменив свое отношение к ним.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Panda Padlovna", | ||
| "images": ["/assets/img/imagesCases/Milana_Clark-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg"], | ||
| "description": "Вдохновение приходит только во время работы. Обстоятельства часто можно изменить, изменив свое отношение к ним.", | ||
| "link": "/" | ||
| }, | ||
| { | ||
| "title": "Tigra Leopardovich", | ||
| "images": ["/assets/img/imagesCases/Luna_Lovegood-new.jpg", "/assets/img/imagesCases/Emily_Blunt-new.jpg", "/assets/img/imagesCases/Koshak_Koteevich.jpg", "/assets/img/imagesCases/Panda_Padlovna.jpg"], | ||
| "description": "Если проблему можно решить, не стоит о ней беспокоиться.", | ||
| "link": "/" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,5 +14,9 @@ | |
| { | ||
| "link":"https://play.mlut.style/", | ||
| "text":"Sandbox" | ||
| }, | ||
| { | ||
| "link":"/showcase", | ||
| "text":"Showcase" | ||
| } | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <% | ||
| const item = it.item; | ||
| const images = item.images && Array.isArray(item.images) ? item.images : []; | ||
| %> | ||
|
|
||
| <li> | ||
| <a class="Txd-n C-ih W100p H100p D-f Fld-c -Bdy -Bdyc-$accent750 -Bdyc-$brand_h Ts-bd,0.3s,e Cs" href="<%= item.link %>"> | ||
| <slider-component images='<%= JSON.stringify(images) %>' title="<%= item.title %>"></slider-component> | ||
| <div class="D-f Fld-c P2.5u Bdt1;s;$accent750"> | ||
| <span class="Mb3u Fns4u"><%= item.title ?? '' %></span> | ||
| <span class="Fns3u C-$gray350"><%= item.description ?? '' %></span> | ||
| </div> | ||
| </a> | ||
| </li> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| const swiperModule = "https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.mjs"; | ||
| const swiperCss = "https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.css"; | ||
|
|
||
| class SliderComponent extends HTMLElement { | ||
| constructor() { | ||
| super(); | ||
| this.images = JSON.parse(this.getAttribute('images') || '[]'); | ||
| this.title = this.getAttribute('title') || ''; | ||
| } | ||
|
|
||
| connectedCallback() { | ||
| this.render(); | ||
| this.ensureStyles(); | ||
| this.loadSwiperModule(); | ||
| } | ||
|
|
||
| render() { | ||
| const slidesHtml = this.images.length > 0 | ||
| ? this.images.map(img => ` | ||
| <div class="swiper-slide"> | ||
| <div class="W100p H244"> | ||
| <img src="${img}" alt="${this.title}" class="H100p W100p Ojf-cv Ojp-c Bdrd8"> | ||
| </div> | ||
| </div> | ||
| `) | ||
| : `<div class="swiper-slide">Нет изображений</div>`; | ||
|
|
||
| this.innerHTML = ` | ||
| <div class="P2.5u"> | ||
| <div class="swiper"> | ||
| <div class="swiper-wrapper">${slidesHtml}</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"> | ||
| <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> | ||
| </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"> | ||
| <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> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| `; | ||
| } | ||
|
|
||
| ensureStyles() { | ||
| if (document.querySelector(`link[href*="swiper-bundle.min.css"]`)) return; | ||
| const link = document.createElement('link'); | ||
| link.rel = 'stylesheet'; | ||
| link.href = swiperCss; | ||
| document.head.appendChild(link); | ||
| } | ||
|
|
||
| async loadSwiperModule() { | ||
| try { | ||
| const { default: Swiper } = await import(swiperModule); | ||
|
|
||
| if (!SliderComponent.Swiper) { | ||
| SliderComponent.Swiper = Swiper; | ||
| } | ||
|
|
||
| if (document.querySelector(`link[href*="swiper-bundle.min.css"]`)) { | ||
| this.initSwiper(Swiper); | ||
| } else { | ||
| this.waitForStylesAndInit(Swiper); | ||
| } | ||
| } catch (error) { | ||
| console.error(error); | ||
| } | ||
| } | ||
|
|
||
| waitForStylesAndInit(Swiper) { | ||
| const checkStyles = () => { | ||
| if (document.querySelector(`link[href*="swiper-bundle.min.css"]`)) { | ||
| this.initSwiper(Swiper); | ||
| } else { | ||
| setTimeout(checkStyles, 50); | ||
| } | ||
| }; | ||
| checkStyles(); | ||
| } | ||
|
|
||
| initSwiper(Swiper) { | ||
| if (!this.isConnected) return; | ||
|
|
||
| const swiperContainer = this.querySelector('.swiper'); | ||
| if (!swiperContainer) { | ||
| return; | ||
| } | ||
|
|
||
| this.swiper = new Swiper(swiperContainer, { | ||
| pagination: { | ||
| el: this.querySelector('.swiper-pagination'), | ||
| clickable: false, | ||
| dynamicBullets: true | ||
| }, | ||
| navigation: { | ||
| nextEl: '.next', | ||
| prevEl: '.prev' | ||
| }, | ||
| loop: true, | ||
| speed: 300, | ||
| effect: 'fade', | ||
| fadeEffect: { crossFade: true }, | ||
| simulateTouch: false, | ||
| allowTouchMove: true, | ||
| autoplay: false, | ||
| grabCursor: false | ||
| }); | ||
|
|
||
| const totalSlides = this.querySelectorAll('.swiper-slide').length; | ||
| swiperContainer.addEventListener('mousemove', (e) => { | ||
| const rect = swiperContainer.getBoundingClientRect(); | ||
| const x = e.clientX - rect.left; | ||
| const percentage = x / rect.width; | ||
| let slideIndex = Math.floor(percentage * totalSlides); | ||
|
|
||
| if (slideIndex >= totalSlides) slideIndex = totalSlides - 1; | ||
| if (slideIndex < 0) slideIndex = 0; | ||
|
|
||
| this.swiper.slideTo(slideIndex, 300, false); | ||
| }); | ||
|
|
||
| swiperContainer.addEventListener('mouseleave', () => { | ||
| this.swiper.slideTo(0, 800, false); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| customElements.define('slider-component', SliderComponent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| title: Showcase | ||
| layout: base.ejs | ||
| --- | ||
|
|
||
| <% | ||
| const bdX = "-Bdx -Bdxc-$accent750"; | ||
| const bdY = "-Bdy -Bdyc-$accent750"; | ||
| %> | ||
|
|
||
| <div class="P-$headerH;5;0 D-f C-$accent900 md_P-$headerH;100;0"> | ||
| <div class="D-n W8u <%= bdX %> md_D-f"></div> | ||
| <div class="Pb40 W100p"> | ||
| <div class="M40;0;60 P0;20 W100p <%= bdY %> md_W-$bleedWidth md_M40;-140;80 md_P0;160"> | ||
| <h1 class="Txa-c M10;0">Showcase</h1> | ||
| </div> | ||
| <div class="D-n H8u W-$bleedWidth Ml-140 <%= bdY %> 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-swiper.ejs', { item: elem }) %> | ||
| <% } %> | ||
| </ul> | ||
| <div class="D-n H8u W-$bleedWidth Ml-140 <%= bdY %> md_D-f"></div> | ||
| </div> | ||
| <div class="D-n W8u <%= bdX %> md_D-f"></div> | ||
| </div> | ||
|
|
||
| <script src="/assets/script/swiper.js" type="module"></script> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Зачем в названии каталога
images, если по верхнему каталогу и так понятно, что тут изображения?