-
Notifications
You must be signed in to change notification settings - Fork 57
/
main.jsx
100 lines (92 loc) · 3.57 KB
/
main.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import React, { createContext, useEffect, useState } from "react";
import ReactDOM from "react-dom/client";
import {
createBrowserRouter,
Route,
RouterProvider,
createRoutesFromElements,
} from "react-router-dom";
import "./index.css";
import Lenis from '@studio-freight/lenis';
import Layout from "./components/Layout.jsx";
import LandingPage from "./Pages/LandingPage.jsx";
import CareersPage from "./Pages/CareersPage.jsx";
import ContactPage from "./Pages/ContactPage.jsx";
import LoginPage from "./Pages/LoginPage.jsx";
import SignupPage from "./Pages/SignupPage.jsx";
import AboutPage from "./Pages/AboutPage.jsx";
import BlogPage from "./Pages/BlogPage.jsx";
import Booking from "./Pages/Booking.jsx";
import Blogs from "./Pages/Blogs.jsx";
import PrivacyPolicy from "./Pages/PrivacyPolicy.jsx";
import Licensing from "./Pages/Licensing.jsx";
import TermsAndConditions from "./Pages/TermsAndConditions.jsx";
import BrandCenter from "./Pages/BrandCenter.jsx";
import ScrollToTopButton from "./ScrollToTopButton"; // Import ScrollToTopButton
import Guidelines from "./Pages/Guidelines.jsx";
import Services from "./Pages/Services.jsx";
import Faq from "./Pages/Faq.jsx";
import FeedbackPage from "./Pages/FeedbackForm.jsx"; // Import FeedbackPage
import NotFound from "./Pages/NotFound.jsx";
import Nurses from "./Pages/Nurses.jsx";
import Patients from "./Pages/Patients.jsx";
const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<Layout />}>
<Route path="" element={<LandingPage />} />
<Route path="careers" element={<CareersPage />} />
<Route path="contact" element={<ContactPage />} />
<Route path="ourbrand" element={<BrandCenter />} />
<Route path="login" element={<LoginPage />} />
<Route path="signup" element={<SignupPage />} />
<Route path="services" element={<Services />} />
<Route path="about" element={<AboutPage />} />
<Route path="blog" element={<BlogPage />} />
<Route path="blog/:slug" element={<Blogs />} />
<Route path="/book-nurse" element={<Booking />} />
<Route path="privacypolicy" element={<PrivacyPolicy />} />
<Route path="guidelines" element={<Guidelines/>}/>
<Route path="licensing" element={<Licensing />} />
<Route path="termsandconditions" element={<TermsAndConditions />} />
<Route path="findnurses" element={<Nurses/>}/>
<Route path="findpatients" element={<Patients/>}/>
<Route path="faq" element={<Faq/>}/>
<Route path="feedback" element={<FeedbackPage />} /> {/* Feedback route */}
<Route path="*" element={<NotFound />} />
</Route>
)
);
export const ThemeContext = createContext(null);
const App = () => {
const [theme, setTheme] = useState(() => {
const storedTheme = localStorage.getItem("theme");
return storedTheme || "light";
});
const toggleTheme = () => {
setTheme((curr) => {
const newTheme = curr === "light" ? "dark" : "light";
localStorage.setItem("theme", newTheme);
return newTheme;
});
};
useEffect(() => {
document.body.className = theme;
}, [theme]);
useEffect(() => {
const lenis = new Lenis();
function raf(time) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
}, []);
return (
<ThemeContext.Provider value={{ theme, toggleTheme }}>
<React.StrictMode>
<RouterProvider router={router} />
<ScrollToTopButton /> {/* Add ScrollToTopButton here */}
</React.StrictMode>
</ThemeContext.Provider>
);
};
ReactDOM.createRoot(document.getElementById("root")).render(<App />);