generated from hack4impact-calpoly/nextjs-app-template
-
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.
Merge pull request #47 from hack4impact-calpoly/combiningComponents
Combining components
- Loading branch information
Showing
7 changed files
with
248 additions
and
97 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,8 +1,10 @@ | ||
import Navbar from "@/components/Navbar"; | ||
import POICardList from "@/components/POICardList"; | ||
export default function Home() { | ||
return ( | ||
<main> | ||
<Navbar /> | ||
<POICardList></POICardList> | ||
</main> | ||
); | ||
} |
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,29 @@ | ||
"use client"; | ||
|
||
import { Suspense } from "react"; // Import Suspense from React | ||
import POICard from "@/components/POICard"; | ||
import { useParams, useSearchParams } from "next/navigation"; | ||
|
||
function POIDetailContent() { | ||
const params = useParams(); | ||
const searchParams = useSearchParams(); | ||
|
||
const { id } = params; | ||
const name = searchParams.get("name"); | ||
const duration = searchParams.get("duration"); | ||
const imageUrl = searchParams.get("url"); | ||
|
||
return ( | ||
<div> | ||
<POICard title={name || "Unknown POI"} duration={duration || "Unknown Duration"} imageUrl={imageUrl}></POICard> | ||
</div> | ||
); | ||
} | ||
|
||
export default function POIDetail() { | ||
return ( | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<POIDetailContent /> | ||
</Suspense> | ||
); | ||
} |
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,9 @@ | ||
.base { | ||
flex: auto; | ||
width: 324.07px; | ||
height: 178.444px; | ||
position: relative; | ||
background-color: white; | ||
border-radius: 16px; | ||
padding: 4px; | ||
} |
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,35 @@ | ||
/* eslint-disable @next/next/no-img-element */ | ||
"use client"; | ||
import styles from "./POICard.module.css"; | ||
import React from "react"; | ||
|
||
interface POICardProps { | ||
title: string | null; | ||
duration: string | null; | ||
imageUrl: string | null; | ||
} | ||
|
||
function POICard({ title, duration, imageUrl }: POICardProps) { | ||
return ( | ||
<div className={styles.base}> | ||
{/* Image Section */} | ||
<div className="rounded-t-2xl overflow-hidden w-full h-[112.81px]"> | ||
<img | ||
src={ | ||
imageUrl || | ||
"https://images.unsplash.com/uploads/141148589884100082977/a816dbd7?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" | ||
} | ||
className="object-cover w-full h-full" | ||
/> | ||
</div> | ||
|
||
{/* Content Section */} | ||
<div className="bg-white rounded-b-2xl p-2 w-full h-[66.66px]"> | ||
<h3 className="text-lg font-semibold text-black ml-1.5">{title}</h3> | ||
<p className="text-sm text-gray-500 ml-1.5">{duration}</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default POICard; |
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
Oops, something went wrong.