parent
8c9ec9bbb2
commit
1d1fa3e99c
42 changed files with 288 additions and 213 deletions
@ -1,68 +1,68 @@ |
|||||||
import React, {useState} from 'react'; |
import React, { useState } from "react"; |
||||||
import Carousel from 'react-elastic-carousel'; |
import Carousel from "react-elastic-carousel"; |
||||||
import Video from '../../../QR/VideoBox/React-video-js-player/index'; |
import Video from "../../../QR/VideoBox/React-video-js-player/index"; |
||||||
import exit from '../../../../assets/icons/exit.svg'; |
import exit from "../../../../assets/icons/exit.svg"; |
||||||
|
|
||||||
import './index.scss'; |
import "./index.scss"; |
||||||
const Modal = (props) => { |
const Modal = (props) => { |
||||||
const [displayed, setDisplayed] = useState(props.first ? props.first : props.gallery[0]) |
const [displayed, setDisplayed] = useState( |
||||||
const {gallery, setModal} = props; |
props.first ? props.first : props.gallery[0] |
||||||
return( |
); |
||||||
|
const { gallery, setModal } = props; |
||||||
|
return ( |
||||||
<> |
<> |
||||||
{ |
{window.innerWidth > 1000 ? ( |
||||||
window.innerWidth > 1000 ? |
|
||||||
<section className="modal d-flex flex-column align-items-center justify-content-center"> |
<section className="modal d-flex flex-column align-items-center justify-content-center"> |
||||||
<img className="modal__exit" src={exit} alt="خروح" onClick={() => setModal(null)} /> |
<img |
||||||
|
className="modal__exit" |
||||||
|
src={exit} |
||||||
|
alt="خروح" |
||||||
|
onClick={() => setModal(null)} |
||||||
|
/> |
||||||
<div className="modal__display"> |
<div className="modal__display"> |
||||||
{ |
{displayed.type === "image" ? ( |
||||||
displayed.type === 'image' ? |
<img src={displayed.value} alt={window.t("عکس")} /> |
||||||
<img src={displayed.value} alt=window.t("عکس") /> : null |
) : null} |
||||||
} |
{displayed.type === "film" ? <Video /> : null} |
||||||
{ |
|
||||||
displayed.type === 'film' ? |
|
||||||
<Video /> : null |
|
||||||
} |
|
||||||
</div> |
</div> |
||||||
<footer className="modal__footer d-flex"> |
<footer className="modal__footer d-flex"> |
||||||
<Carousel |
<Carousel |
||||||
itemsToShow={4} |
itemsToShow={4} |
||||||
isRTL={true} |
isRTL={true} |
||||||
enableTilt={false} |
enableTilt={false} |
||||||
showArrows={true} |
showArrows={true} |
||||||
pagination={false} |
pagination={false} |
||||||
> |
> |
||||||
{gallery.map((item, i) => ( |
{gallery.map((item, i) => ( |
||||||
<Item |
<Item |
||||||
data={item} |
data={item} |
||||||
key={i} |
key={i} |
||||||
setDisplayed={setDisplayed} |
setDisplayed={setDisplayed} |
||||||
active={item === displayed} |
active={item === displayed} |
||||||
/> |
/> |
||||||
))} |
))} |
||||||
</Carousel> |
</Carousel> |
||||||
</footer> |
</footer> |
||||||
</section> : null |
</section> |
||||||
} |
) : null} |
||||||
</> |
</> |
||||||
); |
); |
||||||
} |
}; |
||||||
|
|
||||||
export default Modal; |
export default Modal; |
||||||
|
|
||||||
const Item = (props) => { |
const Item = (props) => { |
||||||
return( |
return ( |
||||||
<div className="modal-carousel-item"> |
<div className="modal-carousel-item"> |
||||||
{ |
{props.data.type === "image" ? ( |
||||||
props.data.type === 'image' ? |
<img src={props.data.value} alt={window.t("عکس")} /> |
||||||
<img src={props.data.value} alt=window.t("عکس") /> : null |
) : null} |
||||||
} |
{props.data.type === "film" ? <Video /> : null} |
||||||
{ |
<div |
||||||
props.data.type === 'film' ? |
style={{ border: props.active ? "4px solid #1BBC6E" : "" }} |
||||||
<Video /> : null |
className="modal-carousel-item__cover" |
||||||
} |
onClick={() => props.setDisplayed(props.data)} |
||||||
<div style={{ border: props.active ? '4px solid #1BBC6E' : '' }} className="modal-carousel-item__cover" onClick={() => props.setDisplayed(props.data)}> |
></div> |
||||||
|
|
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
); |
); |
||||||
}
|
}; |
||||||
|
Loading…
Reference in new issue