2024-07-11 16:45:59 +05:00
|
|
|
import { Route, Routes } from 'react-router-dom'
|
2024-07-10 23:31:54 +05:00
|
|
|
import { Layout } from './layout'
|
2024-07-11 16:45:59 +05:00
|
|
|
import { routes } from './routes'
|
2024-08-14 15:17:37 +05:00
|
|
|
import { useEffect } from 'react'
|
|
|
|
import './styles/styles.css'
|
2024-07-10 23:31:54 +05:00
|
|
|
|
2024-07-10 20:57:37 +05:00
|
|
|
function App() {
|
2024-08-14 15:17:37 +05:00
|
|
|
useEffect(() => {
|
|
|
|
// Find the element with id 'root'
|
|
|
|
const rootElement = document.getElementById('root')
|
|
|
|
|
|
|
|
if (rootElement) {
|
|
|
|
// Add the class to the element
|
|
|
|
rootElement.classList.add('bodyMain')
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cleanup function (optional): Remove the class when the component unmounts
|
|
|
|
return () => {
|
|
|
|
if (rootElement) {
|
|
|
|
rootElement.classList.remove('bodyMain')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [])
|
|
|
|
|
2024-07-11 16:45:59 +05:00
|
|
|
return (
|
|
|
|
<Routes>
|
|
|
|
<Route element={<Layout />}>
|
|
|
|
{routes.map((route, index) => (
|
|
|
|
<Route
|
|
|
|
key={route.path + index}
|
|
|
|
path={route.path}
|
|
|
|
element={route.element}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Route>
|
|
|
|
</Routes>
|
|
|
|
)
|
2024-07-10 20:57:37 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|