-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add routing, useable navbar and art description page
- Loading branch information
Showing
3 changed files
with
142 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; | ||
import Navbar from './components/Navbar'; | ||
import Home from './pages/Home'; | ||
import Footer from './components/Footer'; | ||
import ErrorPage from './pages/Error'; | ||
|
||
import Home from './pages/Home'; | ||
import TopPicks from './pages/TopPicks'; | ||
import ArtDescription from './pages/ArtDescription'; | ||
import ErrorPage from './pages/Error'; | ||
|
||
function App() { | ||
return ( | ||
<div className="flex flex-col justify-start items-start min-h-screen bg-gray-100"> | ||
<Router> | ||
{/* Navigation Bar */} | ||
<Navbar /> | ||
|
||
{/* Route Definitions */} | ||
<Routes> | ||
{/* Home Page */} | ||
<Route exact path="/artistry-hub/" element={<Home />} /> | ||
|
||
{/* Top Picks Page */} | ||
<Route exact path="/artistry-hub/top-picks" element={<TopPicks />} /> | ||
{/* <Route component={GenericNotFound} /> */} | ||
|
||
{/* Art Description Page */} | ||
<Route path="/artistry-hub/art/:id" element={<ArtDescription />} /> | ||
|
||
{/* Fallback Error Page for Unmatched Routes */} | ||
<Route path="*" element={<ErrorPage />} /> | ||
</Routes> | ||
</Router> | ||
|
||
{/* Footer */} | ||
<Footer /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useParams } from 'react-router-dom'; | ||
import { allLists } from '../data/list'; | ||
import { Card, CardHeader, CardBody, Image } from '@nextui-org/react'; | ||
|
||
const ArtDescription = () => { | ||
let { id } = useParams(); | ||
let artItem = null; | ||
|
||
// Iterate over each list in allLists to find the art item | ||
for (const listKey in allLists) { | ||
if (Object.prototype.hasOwnProperty.call(allLists, listKey)) { | ||
artItem = allLists[listKey].find((item) => item.id.toString() === id); | ||
if (artItem) break; | ||
} | ||
} | ||
|
||
// if (!artItem) { | ||
// return <div className="text-xl font-bold p-4">Artwork not found</div>; | ||
// } | ||
|
||
return ( | ||
<div className="flex flex-col md:flex-row p-4 gap-4"> | ||
<div className="flex-1"> | ||
<Image | ||
src={artItem.img} | ||
alt={artItem.name} | ||
objectFit="cover" | ||
width="100%" | ||
height="100%" | ||
/> | ||
</div> | ||
<div className="flex-1"> | ||
<Card> | ||
<CardHeader> | ||
<h2 className="text-2xl font-bold">{artItem.name}</h2> | ||
<p className="text-lg"> by {artItem.artist}</p> | ||
</CardHeader> | ||
<CardBody> | ||
<p className="text-md">{artItem.description}</p> | ||
<p className="text-md">Year: {artItem.date}</p> | ||
<p className="text-md">Style: {artItem.style}</p> | ||
<p className="text-md">Dimensions: {artItem.dimensions}</p> | ||
<p className="text-md">Location: {artItem.location}</p> | ||
</CardBody> | ||
</Card> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ArtDescription; |