revert carousel

This commit is contained in:
Martin Quarda 2024-05-08 13:43:28 +02:00
parent 90d5108544
commit 4911f8fdc9

View File

@ -43,14 +43,6 @@ class Main extends Component {
onHashChange(event){
this.setState({page: window.location.hash})
}
onViewChange(index){
let new_index = (this.state.currentImage - 1 + index) % this.state.photos.length
if (new_index < 0){
new_index += this.state.photos.length
}
this.setState({currentImage: new_index})
this.carousel && this. carousel.setState({currentIndex: 1})
}
onSubmit(event){
event.preventDefault();
let form = document.getElementById("form");
@ -84,25 +76,16 @@ class Main extends Component {
width: photo.original_width,
height: photo.original_height,
})
}
if (this.state.photos.length > 3){
for(let i=this.state.currentImage-1; i<=this.state.currentImage+1; i++){
let j = i;
if(j < 0){
j += this.state.photos.length;
}
photos_carousel.push({'source': this.state.photos[j % this.state.photos.length].original})
}
}
this.carousel = this.state.photoIsOpen && <Carousel views={photos_carousel} currentIndex={1} trackProps={{onViewChange: (v) => this.onViewChange(v)}}/>
photos_carousel.push({
source: photo.original
})
};
return (
<div>
<ModalGateway>
{this.state.photoIsOpen &&
<Modal onClose={this.togglePhoto}>
{this.carousel}
<Carousel views={photos_carousel} currentIndex={this.state.currentImage} />
</Modal>
}
</ModalGateway>
@ -120,7 +103,7 @@ class Main extends Component {
</nav>
{this.state.page == "#gallery" &&
<div class="container">
<Gallery photos={photos_gallery } onClick={this.openPhoto}/>
<Gallery photos={photos_gallery} onClick={this.openPhoto}/>
</div>
}
{this.state.page == "" &&