-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Valik3201/feature/swiper-with-charity-fou…
…ndations Feature/swiper with charity foundations
- Loading branch information
Showing
21 changed files
with
544 additions
and
157 deletions.
There are no files selected for viewing
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.
File renamed without changes
File renamed without changes
File renamed without changes
This file contains 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 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 |
---|---|---|
@@ -1,49 +1,92 @@ | ||
const charityData = [ | ||
export const charityData = [ | ||
{ | ||
title: 'Save the Children', | ||
url: 'https://www.savethechildren.net/what-we-do/emergencies/ukraine-crisis', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/save-children.png', import.meta.url).href, | ||
img1x: new URL('/src/images/save-children2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/save-children3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/save-children4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'Project HOPE', | ||
url: 'https://www.projecthope.org/country/ukraine/', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/project-hope.png', import.meta.url).href, | ||
img1x: new URL('/src/images/project-hope2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/project-hope3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/project-hope4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'UNITED24', | ||
url: 'https://u24.gov.ua/uk', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/united24.png', import.meta.url).href, | ||
img1x: new URL('/src/images/united242x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/united243x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/united244x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'International Medical Corps', | ||
url: 'https://internationalmedicalcorps.org/country/ukraine/', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/medical-corps.png', import.meta.url).href, | ||
img1x: new URL('/src/images/medical-corps2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/medical-corps3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/medical-corps4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'Medicins Sans Frontieres', | ||
url: 'https://www.msf.org/ukraine', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/msf.png', import.meta.url).href, | ||
img1x: new URL('/src/images/msf2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/msf3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/msf4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'RAZOM', | ||
url: 'https://www.razomforukraine.org/', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/razom.png', import.meta.url).href, | ||
img1x: new URL('/src/images/razom2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/razom3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/razom4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'Action against hunger', | ||
url: 'https://www.actionagainsthunger.org/location/europe/ukraine/', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/against-hunger.png', import.meta.url).href, | ||
img1x: new URL('/src/images/against-hunger2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/against-hunger3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/against-hunger4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'World vision', | ||
url: 'https://www.wvi.org/emergencies/ukraine', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/world-vision.png', import.meta.url).href, | ||
img1x: new URL('/src/images/world-vision2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/world-vision3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/world-vision4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
{ | ||
title: 'Serhiy Prytula Charity Foundation', | ||
url: 'https://prytulafoundation.org/en', | ||
img: null, | ||
imgUrl: { | ||
img: new URL('/src/images/sergiy-prytula.png', import.meta.url).href, | ||
img1x: new URL('/src/images/sergiy-prytula2x.png', import.meta.url).href, | ||
img2x: new URL('/src/images/sergiy-prytula3x.png', import.meta.url).href, | ||
img3x: new URL('/src/images/sergiy-prytula4x.png', import.meta.url).href, | ||
}, | ||
}, | ||
]; | ||
|
||
export default charityData; |
This file contains 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,58 @@ | ||
// import Swiper JS | ||
import Swiper from 'swiper'; | ||
import { Navigation } from 'swiper/modules'; | ||
// import Swiper styles | ||
import 'swiper/swiper.min.css'; | ||
import 'swiper/swiper-bundle.min.css'; | ||
|
||
import { charityData } from './charityData.js'; | ||
|
||
Swiper.use([Navigation]); | ||
|
||
const isMobile = window.innerWidth < 768; | ||
const slidesPerView = isMobile ? 4 : 6; | ||
|
||
const swiper = new Swiper('.swiper-container', { | ||
direction: 'vertical', | ||
loop: false, | ||
slidesPerView: slidesPerView, | ||
spaceBetween: 20, | ||
navigation: { | ||
nextEl: '.swiper-button-next', | ||
prevEl: '.swiper-button-prev', | ||
}, | ||
}); | ||
|
||
// Заполните слайды вашими данными | ||
const foundationList = document.querySelector('.swiper-wrapper'); | ||
|
||
charityData.forEach(function (item, index) { | ||
var slideNumber = (index + 1).toString().padStart(2, '0'); | ||
var imgSrc = item.imgUrl.img; | ||
var imgSrcset = ` | ||
${item.imgUrl.img} 1x, | ||
${item.imgUrl.img1x} 2x, | ||
${item.imgUrl.img2x} 3x | ||
`; | ||
|
||
var slideHTML = ` | ||
<div class="swiper-slide"> | ||
<div class="swiper-slide-number">${slideNumber}</div> | ||
<a href="${item.url}" target="_blank"> | ||
<img src="${imgSrc}" srcset="${imgSrcset}" alt="${item.title}"> | ||
</a> | ||
</div> | ||
`; | ||
|
||
foundationList.insertAdjacentHTML('beforeend', slideHTML); | ||
}); | ||
|
||
swiper.on('reachEnd', function () { | ||
document.querySelector('.swiper-button-next').style.display = 'none'; | ||
document.querySelector('.swiper-button-prev').style.display = 'block'; | ||
}); | ||
|
||
swiper.on('reachBeginning', function () { | ||
document.querySelector('.swiper-button-prev').style.display = 'none'; | ||
document.querySelector('.swiper-button-next').style.display = 'block'; | ||
}); |
This file contains 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import './charityData.js'; | ||
import './charitySwiper.js'; | ||
import './mobileMenu.js'; | ||
import './darkMode.js'; | ||
import './auth.js'; | ||
import './scrollUp.js'; | ||
|
||
import 'lazysizes'; | ||
import 'lazysizes/plugins/attrchange/ls.attrchange'; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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,15 @@ | ||
<div class="foundation-list"> | ||
<div class="swiper-header"> | ||
<h2>Support Ukraine</h2> | ||
<svg class="ukraine-icon" width="20" height="32" fill="currentColor"> | ||
<use href="/src/images/icons.svg#icon-support"></use> | ||
</svg> | ||
</div> | ||
|
||
<div class="swiper-container"> | ||
<div class="swiper-wrapper"></div> | ||
|
||
<div class="swiper-button-next"></div> | ||
<div class="swiper-button-prev"></div> | ||
</div> | ||
</div> |
This file contains 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 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
Oops, something went wrong.