-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:update payment section in registration page (#226)
* Feat: improved Upper Slider,lower Slider,fix Responsiveness of EventPage * Feat:fix minor changes * feat:add payment Section in Register Form * feat:update payment section in register page * feat:update payment section in registration page * feat: fix prettier issue * fix: prettier fix * feat: update Payment Section * fix:prettier issue
- Loading branch information
Showing
21 changed files
with
260 additions
and
359 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
'use client'; | ||
|
||
import { useState, useEffect, useRef } from 'react'; | ||
import { useAnimate } from 'framer-motion'; | ||
import { Swiper } from 'swiper/react'; | ||
import { Autoplay, Pagination } from 'swiper/modules'; | ||
import { ScreenViewContainer, SliderContainer, Wrapper } from './Carousel.styles'; | ||
import { LeftArrowButton, RightArrowButton } from '../EventsPage/Shared/ArrowButton'; | ||
import DescriptionCarousel from '../EventsPage/Carousel/DescriptionCarousel'; | ||
import '../EventsPage/Carousel/swiper.css'; | ||
|
||
export const SwiperCarousel = ({ | ||
mapFunction, | ||
mobileViewClassName, | ||
desktopViewClassname, | ||
descriptionItems, | ||
onIndexChange, | ||
isEventSection, | ||
}) => { | ||
const [scope, animate] = useAnimate(); | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
const [isMobile, setIsMobile] = useState(false); | ||
const swiperRef = useRef(null); | ||
const slideWidth = 456.74; | ||
|
||
useEffect(() => { | ||
const updateScreenSize = () => { | ||
setIsMobile(typeof window !== 'undefined' && window.innerWidth < 900); | ||
}; | ||
|
||
updateScreenSize(); | ||
window.addEventListener('resize', updateScreenSize); | ||
return () => window.removeEventListener('resize', updateScreenSize); | ||
}, []); | ||
|
||
const handleNext = () => { | ||
swiperRef.current?.swiper.slideNext(); | ||
}; | ||
|
||
const handlePrev = () => { | ||
swiperRef.current?.swiper.slidePrev(); | ||
}; | ||
|
||
const onSlideChange = (swiper) => { | ||
const newIndex = swiper.realIndex; | ||
setCurrentIndex(newIndex); | ||
if (onIndexChange) { | ||
onIndexChange(newIndex); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
if (scope.current) { | ||
const xOffset = -currentIndex * slideWidth; | ||
animate( | ||
scope.current, | ||
{ x: xOffset }, | ||
{ | ||
duration: 7, | ||
ease: [0.42, 0, 0.58, 1], | ||
type: 'tween', | ||
}, | ||
); | ||
} | ||
}, [currentIndex, animate, scope]); | ||
|
||
return ( | ||
<Wrapper> | ||
<ScreenViewContainer> | ||
<LeftArrowButton | ||
onClick={handlePrev} | ||
style={{ position: 'absolute', left: '10px', top: '50%', zIndex: 10 }} | ||
/> | ||
<SliderContainer> | ||
<Swiper | ||
ref={swiperRef} | ||
slidesPerView={isMobile ? 1 : 3} | ||
centeredSlides | ||
loop | ||
spaceBetween={isMobile ? 30 : 0} | ||
onSlideChange={onSlideChange} | ||
modules={[Pagination, Autoplay]} | ||
autoplay={{ delay: isEventSection ? 3000 : 15000, disableOnInteraction: false }} | ||
className={isMobile ? mobileViewClassName : desktopViewClassname} | ||
> | ||
{mapFunction()} | ||
</Swiper> | ||
</SliderContainer> | ||
<RightArrowButton | ||
onClick={handleNext} | ||
style={{ position: 'absolute', right: '10px', top: '50%', zIndex: 10 }} | ||
/> | ||
</ScreenViewContainer> | ||
{!isEventSection && ( | ||
<DescriptionCarousel descriptionItems={descriptionItems} currentIndex={currentIndex} /> | ||
)} | ||
</Wrapper> | ||
); | ||
}; |
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
4 changes: 2 additions & 2 deletions
4
...scriptionCarousel/DescriptionCarousel.jsx → ...entsPage/Carousel/DescriptionCarousel.jsx
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use client'; | ||
|
||
import { SwiperSlide } from 'swiper/react'; | ||
import PreviewCard from '../CardComponents/PreviewCard'; | ||
import { SwiperCarousel } from '@/components/Carousel/Carousel'; | ||
import { useState } from 'react'; | ||
|
||
export const SliderEventsWrapper = ({ previewItems, descriptionItems }) => { | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
|
||
const renderSlides = () => | ||
previewItems.map((item, index) => ( | ||
<SwiperSlide key={index} className={`slide ${index === currentIndex ? 'active-slide' : ''}`}> | ||
<PreviewCard PreviewDescription={item.PreviewDescription} ImageURL={item.ImageURL} /> | ||
</SwiperSlide> | ||
)); | ||
|
||
return ( | ||
<SwiperCarousel | ||
mapFunction={renderSlides} | ||
desktopViewClassname='mySwiper' | ||
mobileViewClassName='mySwiper2' | ||
descriptionItems={descriptionItems} | ||
onIndexChange={setCurrentIndex} | ||
/> | ||
); | ||
}; |
37 changes: 0 additions & 37 deletions
37
src/components/EventsPage/Carousel/SliderCarousel/DesktopView.jsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.