Skip to content

Commit cc98a1e

Browse files
Merge pull request #63 from Mern-Coding-School/develop
Develop
2 parents 8537fe5 + 701d9e5 commit cc98a1e

15 files changed

Lines changed: 115 additions & 34 deletions

File tree

src/App.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import React from 'react';
1+
import React, {
2+
useEffect,
3+
} from 'react';
24
import Body from './Body';
35
import {
46
BrowserRouter,
@@ -9,9 +11,16 @@ import ErrorPage from './components/ErrorPage';
911
import About from './pages/About';
1012
import Landing from './pages/Home';
1113
import Student from './pages/Student';
12-
import Album_Image from './pages/Album_Image';
13-
import ContactUs from './components/ContactUs';
14+
import Album_Image from './components/Album_Image_Components/Album_Image';
15+
import ContactUs from './pages/ContactUs';
16+
import Loader from './components/Loader';
1417
const App = () => {
18+
useEffect(() => {
19+
window.onload = () => {
20+
return <Loader />;
21+
};
22+
}, []);
23+
1524
return (
1625
<>
1726
<BrowserRouter basename='/'>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import axios from 'axios';
2+
import React from 'react';
3+
import { useParams } from 'react-router-dom';
4+
import Swal from 'sweetalert2';
5+
6+
const Album_Image = () => {
7+
let parms = useParams();
8+
let name = parms.name;
9+
10+
let Find_Image = async () => {
11+
try {
12+
// let res = await axios.get(`/api/image/${name}`)
13+
} catch (error) {
14+
console.log(error);
15+
Swal.fire(() => {
16+
icon: 'error';
17+
title: 'Oops...';
18+
text: error.message;
19+
});
20+
}
21+
};
22+
23+
Find_Image();
24+
25+
return (
26+
<div>
27+
Album_Image <h1>{name}</h1>
28+
</div>
29+
);
30+
};
31+
32+
export default Album_Image;

src/components/Loader.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useRef } from 'react';
22
import gsap from 'gsap';
33
import { useGSAP } from '@gsap/react';
4+
import { useSelector } from 'react-redux';
45

56
const Loader = () => {
67
let loader = useRef();

src/components/aboutComponents/AboutHero.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React, {
55
import About_BG from '../../assets/images/aboutbg.svg';
66
import Loader from '../Loader';
77
import { useSelector } from 'react-redux';
8+
import useAbout from '../../hooks/useAbout';
89

910
const AboutHero = () => {
1011
const [image, setimage] =
@@ -13,6 +14,8 @@ const AboutHero = () => {
1314
const [heading, setheading] =
1415
useState('');
1516

17+
useAbout();
18+
1619
let about = useSelector(
1720
state => state.about.aboutPage,
1821
);
@@ -28,9 +31,7 @@ const AboutHero = () => {
2831
);
2932
}
3033
}, [about]);
31-
return !about ? (
32-
<Loader />
33-
) : (
34+
return (
3435
<section className='bg-black w-full text-white'>
3536
<div className='about_hero relative w-full h-[90vh] bg-gradient-to-b from-white via-gray-700 to-black'>
3637
<img

src/components/aboutComponents/CampusFacilities.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Link } from 'react-router-dom';
66
import bulletPoint from '../../assets/images/bulletPoint.svg';
77
import { useSelector } from 'react-redux';
88
import { use } from 'react';
9+
import useAbout from '../../hooks/useAbout';
910

1011
export let Facilites_Card = ({
1112
Title,
@@ -34,6 +35,8 @@ const CampusFacilities = () => {
3435
const [Description, setDescription] =
3536
useState({});
3637

38+
useAbout();
39+
3740
let About_Page_Data = useSelector(
3841
state => state.about.aboutPage,
3942
);

src/components/aboutComponents/Teachers.jsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import React from 'react';
1+
import React, {
2+
useEffect,
3+
useState,
4+
} from 'react';
25
import {
36
Swiper,
47
SwiperSlide,
@@ -14,6 +17,7 @@ import 'swiper/css/navigation';
1417
import { useSelector } from 'react-redux';
1518
import { Link } from 'react-router-dom';
1619
import useTeacher from '../../hooks/useTeacher';
20+
import Loader from '../Loader';
1721

1822
const TeacherCard = ({ teacher }) => (
1923
<div className='card w-[25%] max-[599px]:w-full h-full bg-white text-black flex items-start p-4 justify-between flex-col gap-2 rounded-xl max-[1098px]:w-[40%]'>
@@ -128,11 +132,24 @@ const TeacherCard = ({ teacher }) => (
128132
);
129133

130134
const Teachers = () => {
131-
const teachers = useSelector(
135+
let [teachers, SetTeacher] =
136+
useState();
137+
138+
useTeacher();
139+
140+
const data = useSelector(
132141
state => state.about.teacher,
133142
);
134143

135-
useTeacher();
144+
useEffect(() => {
145+
if (data) {
146+
SetTeacher([...data]);
147+
}
148+
}, [data]);
149+
150+
{
151+
!data && <Loader />;
152+
}
136153

137154
return (
138155
<section className='w-full px-10 py-10 max-[599px]:py-6 flex items-center justify-between gap-4 flex-col bg-[#333] text-white overflow-hidden'>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
useState,
55
} from 'react';
66
import { Link } from 'react-router-dom';
7-
import useAlbum from '../hooks/useAlbum';
7+
import useAlbum from '../../hooks/useAlbum';
88
import { useSelector } from 'react-redux';
99

1010
const Album = () => {

src/components/homeComponents/Hero.jsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@ import React, {
55
useState,
66
} from 'react';
77
import Loader from '../Loader';
8+
import useHomeUi from '../../hooks/useHomeUi';
89

910
const Hero = () => {
1011
let [image, setImage] = useState();
12+
1113
const [heading, setHeading] =
1214
useState();
1315
const [Paragraph, setParagraph] =
1416
useState();
1517

18+
useHomeUi();
19+
1620
let hero = useSelector(
1721
state => state.home.landingPage,
1822
);
1923

2024
useEffect(() => {
21-
setImage('');
22-
setHeading('');
23-
setParagraph(
24-
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo, nemo.',
25-
);
26-
2725
if (hero) {
2826
let data = hero.HeroSection;
2927
setImage(
@@ -34,9 +32,7 @@ const Hero = () => {
3432
}
3533
}, [hero]);
3634

37-
return !hero ? (
38-
<Loader />
39-
) : (
35+
return (
4036
<section
4137
className='w-full min-h-screen flex flex-col lg:flex-row items-center justify-center text-white bg-cover bg-no-repeat px-10 relative overflow-clip'
4238
style={{

src/components/Testimonials.jsx renamed to src/components/homeComponents/Testimonials.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import Slider from 'react-slick';
66
import 'slick-carousel/slick/slick.css';
77
import 'slick-carousel/slick/slick-theme.css';
88

9-
import useTestimonial from '../hooks/useTestimoniyal';
9+
import useTestimonial from '../../hooks/useTestimoniyal';
1010
import { useSelector } from 'react-redux';
1111

1212
const Testimonials = () => {
13+
useTestimonial();
14+
1315
let testimonial = useSelector(
1416
state => state.home.Testimonital,
1517
);
@@ -19,8 +21,6 @@ const Testimonials = () => {
1921
setTestimonials,
2022
] = useState([]);
2123

22-
useTestimonial();
23-
2424
useEffect(() => {
2525
if (testimonial) {
2626
setTestimonials([...testimonial]);

src/main.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Provider } from 'react-redux';
66
import App from './App';
77
import { HelmetProvider } from 'react-helmet-async';
88
import Lenis from 'lenis';
9+
import Loader from './components/Loader';
910

1011
// Initialize Lenis
1112
const lenis = new Lenis({

0 commit comments

Comments
 (0)