Skip to content

Commit

Permalink
style: add spinner in the middle of screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kyziq committed Jan 11, 2024
1 parent 96e1aa8 commit e4d7266
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { Suspense, lazy } from 'react';
import Navbar from './components/Navbar';
import Footer from './components/Footer';
import { Spinner } from '@nextui-org/react';

// Lazy loading of route components
const Home = lazy(() => import('./pages/Home'));
Expand All @@ -16,7 +17,13 @@ function App() {
<Navbar />

{/* Suspense fallback during lazy loading */}
<Suspense fallback={<div>Loading...</div>}>
<Suspense
fallback={
<div className="flex justify-center items-center h-screen fixed top-0 left-0 w-full bg-gray-100">
<Spinner size="lg" />
</div>
}
>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/top-picks" element={<TopPicks />} />
Expand Down

0 comments on commit e4d7266

Please sign in to comment.