diff --git a/pages/Gallery.js b/pages/Gallery.js index 2e07d0a..4fa30a5 100644 --- a/pages/Gallery.js +++ b/pages/Gallery.js @@ -1,7 +1,7 @@ -import React, { useEffect, useState} from 'react'; +import React, { useEffect, useState } from 'react'; import axios from "axios"; import AppContainer from "./appContainer"; -import {AppFile, AppUrl} from "../lib/api"; +import { AppFile, AppUrl } from "../lib/api"; import Image from "next/image"; import dynamic from "next/dynamic"; import { Suspense } from 'react' @@ -12,8 +12,8 @@ import { MDBContainer, MDBRow, } from "mdb-react-ui-kit"; -import {LightBox} from "react-lightbox-pack"; -import {Button, Divider, Tab, TabList, TabPanel, TabPanels, Tabs} from "@chakra-ui/react"; +import { LightBox } from "react-lightbox-pack"; +import { Button, Divider, Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react"; const APV = dynamic(() => import('./components/Videos'), { ssr: false, @@ -40,25 +40,25 @@ const toBase64 = (str) => const Gallery = (dataImage) => { const [Images, SetImages] = useState(dataImage) const [justifyActive, setJustifyActive] = React.useState('tab1'); - const [toggle, setToggle] = React.useState(false); - const [sIndex, setSIndex] = React.useState(0); - const [filterId, setFilterId] = React.useState(1); - const Parallax = ({ quality }) => { + const [toggle, setToggle] = React.useState(false); + const [sIndex, setSIndex] = React.useState(0); + const [filterId, setFilterId] = React.useState(1); + const Parallax = ({ quality }) => { return `../resource/parallax/Gallery.jpg`; } const Filter = async (filter) => { const res = await axios.get(AppUrl(`FilterGalleyImages/${filter}`)); - SetImages({dataImage : res.data}) + SetImages({ dataImage: res.data }) setFilterId(filter) } - + const AllImage = async () => { const res = await axios.get(AppUrl(`GetGalleyImages`)); - SetImages({dataImage: res.data}) + SetImages({ dataImage: res.data }) } // Handler - const lightBoxHandler = (state, sIndex) => { + const lightBoxHandler = (state, sIndex) => { setToggle(state); setSIndex(sIndex); }; @@ -88,7 +88,7 @@ const Gallery = (dataImage) => {
-

گالری بیمارستان

+

گالری بیمارستان

{ alt="درباره بیارستان مهر ایرانیان پرند " width={3000} height={1300} - /> + />
-
- - - {/* ویدئو ها */} - تصاویر - - - - - - -
- Filter(2)} color={filterId === 2 ? 'light' : 'light'} className={filterId === 2 ? 'm-2' : 'm-2 text-dark'}>تصاویر در حال ساخت - Filter(1)} color={filterId === 1 ? 'light' : 'light'} className={'m-2'}>تصاویر معماری - AllImage()} color={filterId !== 1 && 2 ? 'light' : 'light'} className={'m-2'}>همه تصاویر -
- - - {Images && Images.dataImage.map((image ,index)=> { - return ( - -
- {image.title} { - lightBoxHandler(true, index); - }} - /> -
- { image.title } -
-
- ) - })} -
-
-
-
+
+ + + {/* ویدئو ها */} + تصاویر + - -
-
-
-
-
+ +
+ Filter(2)} color={filterId === 2 ? 'light' : 'light'} className={filterId === 2 ? 'm-2' : 'm-2 text-dark'}>تصاویر در حال ساخت + Filter(1)} color={filterId === 1 ? 'light' : 'light'} className={'m-2'}>تصاویر معماری + AllImage()} color={filterId !== 1 && 2 ? 'light' : 'light'} className={'m-2'}>همه تصاویر +
+ + + {Images && Images.dataImage.map((image, index) => { + return ( + +
+ {image.title} { + lightBoxHandler(true, index); + }} + /> +
+ {image.title} +
+
+ ) + })} +
+ +
+
+
+
+
@@ -169,7 +162,7 @@ export async function getServerSideProps(context) { const res = await axios.get(AppUrl('GetGalleyImages')); return { props: { - dataImage : res.data + dataImage: res.data }, // will be passed to the page component as props } }