|
|
@ -32,14 +32,14 @@ export default function Gallery(props) { |
|
|
|
{ |
|
|
|
{ |
|
|
|
props.gallery.length > 3 ? |
|
|
|
props.gallery.length > 3 ? |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Item item={props.gallery[0]} key={props.gallery[0].id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item active={selectedMedia === props.gallery[0]} item={props.gallery[0]} key={props.gallery[0].id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item item={props.gallery[1]} key={props.gallery[1].id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item active={selectedMedia === props.gallery[1]} item={props.gallery[1]} key={props.gallery[1].id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item item={props.gallery[2]} key={props.gallery[2].id} more={true} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item active={selectedMedia === props.gallery[2]} item={props.gallery[2]} key={props.gallery[2].id} more={true} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
</> : |
|
|
|
</> : |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ |
|
|
|
{ |
|
|
|
props.gallery.map((item, i) => ( |
|
|
|
props.gallery.map((item, i) => ( |
|
|
|
<Item item={item} key={item.id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
<Item active={selectedMedia === item} item={item} key={item.id} more={false} setSelectedMedia={setSelectedMedia} setModal={setModal} /> |
|
|
|
)) |
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
</> |
|
|
|
</> |
|
|
@ -56,12 +56,12 @@ export default function Gallery(props) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const Item = (props) => { |
|
|
|
const Item = (props) => { |
|
|
|
const {item, more, setSelectedMedia, setModal} = props; |
|
|
|
const {item, more, setSelectedMedia, setModal, active} = props; |
|
|
|
return( |
|
|
|
return( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ |
|
|
|
{ |
|
|
|
window.innerWidth > 1000 ? |
|
|
|
window.innerWidth > 1000 ? |
|
|
|
<div className="product-gallery-item d-flex"> |
|
|
|
<div style={{ border: active ? '4px solid #1BBC6E' : ''}} className="product-gallery-item d-flex"> |
|
|
|
{ |
|
|
|
{ |
|
|
|
item.type === 'image' ? |
|
|
|
item.type === 'image' ? |
|
|
|
<img src={item.value} alt={'عکس'} /> : null |
|
|
|
<img src={item.value} alt={'عکس'} /> : null |
|
|
|