-
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: refactor landing page, make example cards fetch current data (#56)
- Loading branch information
1 parent
70b721f
commit 665ecc9
Showing
6 changed files
with
178 additions
and
130 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
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,38 @@ | ||
import { | ||
Popover, | ||
PopoverContent, | ||
PopoverTrigger, | ||
} from "@/components/ui/popover"; | ||
import { HelpCircle } from "lucide-react"; | ||
|
||
import Link from "next/link"; | ||
|
||
const ArticulableDefinition = () => { | ||
return ( | ||
<Popover> | ||
<PopoverTrigger aria-label="definition"> | ||
<HelpCircle className="inline-block h-4 w-4" /> | ||
</PopoverTrigger> | ||
<PopoverContent> | ||
<p className="text-sm text-muted-foreground"> | ||
"An articulated course is a course... that can be used | ||
to satisfy... general education requirements at another | ||
college or university." - <br /> | ||
<Link | ||
href={ | ||
"https://www.sdmesa.edu/about-mesa/administration/articulation/homepage-docs/Articulated%20vs%20Transferable.pdf" | ||
} | ||
referrerPolicy="no-referrer" | ||
target="_blank" | ||
> | ||
<i> | ||
<u>San Diego Mesa College</u> | ||
</i> | ||
</Link> | ||
</p> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default ArticulableDefinition; |
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,89 @@ | ||
"use client"; | ||
|
||
import { | ||
Card, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card"; | ||
import { DatabaseReturn, queryDatabase } from "@/lib/utils/query-db"; | ||
import Link from "next/link"; | ||
import { useEffect, useState } from "react"; | ||
|
||
interface Example { | ||
name: string; | ||
geText: string; | ||
institution: string; | ||
ge: string; | ||
link: string; | ||
} | ||
|
||
const EXAMPLES: Example[] = [ | ||
{ | ||
name: "UC Irvine", | ||
geText: "GE IV - Arts and Humanities", | ||
institution: "UCI", | ||
ge: "IV", | ||
link: "/search?uni=UCI&ge=GE%20IV", | ||
}, | ||
{ | ||
name: "UCLA", | ||
geText: "Life Sciences", | ||
institution: "UCLA", | ||
ge: "Scientific Inquiry: Life Sciences", | ||
link: "search?uni=UCLA&ge=Scientific%20Inquiry%3A%20Life%20Sciences", | ||
}, | ||
{ | ||
name: "UC Santa Barbara", | ||
geText: "GE E - Culture and Thought", | ||
institution: "UCSB", | ||
ge: "E", | ||
link: "/search?uni=UCSB&ge=GE%20E", | ||
}, | ||
]; | ||
|
||
const ExampleCard = ({ example }: { example: Example }) => { | ||
const [data, setData] = useState<DatabaseReturn>(); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const courses = await queryDatabase( | ||
example.institution, | ||
example.ge, | ||
); | ||
setData(courses); | ||
}; | ||
fetchData(); | ||
}, [example.name, example.ge]); | ||
|
||
return ( | ||
<Link href={example.link} key={example.name + example.ge}> | ||
<Card className="w-[275px] drop-shadow-md hover:shadow-md sm:w-[300px]"> | ||
<CardHeader> | ||
<CardTitle>{example.name}</CardTitle> | ||
<CardDescription>{example.geText}</CardDescription> | ||
</CardHeader> | ||
<CardFooter className="flex text-neutral-600"> | ||
<span className="font-bold text-primary"> | ||
<b>{data?.data.length ?? "..."}</b> | ||
</span> | ||
Courses | ||
<span className="hidden sm:flex">Found</span> | ||
</CardFooter> | ||
</Card> | ||
</Link> | ||
); | ||
}; | ||
|
||
const Examples = () => { | ||
return ( | ||
<div className="flex flex-wrap gap-4 px-6 sm:justify-center lg:px-8"> | ||
{EXAMPLES.map((example) => ( | ||
<ExampleCard example={example} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Examples; |
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,36 @@ | ||
const Graphics = () => { | ||
return ( | ||
<div> | ||
<div className="relative isolate"> | ||
<div | ||
aria-hidden="true" | ||
className="pointer-events-none absolute inset-x-0 -top-40 -z-10 transform-gpu blur-[52px] sm:-top-48" | ||
> | ||
<div | ||
style={{ | ||
clipPath: | ||
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)", | ||
}} | ||
className="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[26.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-500 to-purple-500 opacity-30 sm:left-[calc(50%-30rem)] sm:w-[42.1875rem]" | ||
/> | ||
</div> | ||
</div> | ||
<div className="relative isolate hidden md:flex"> | ||
<div | ||
aria-hidden="true" | ||
className="pointer-events-none absolute inset-x-0 -top-40 -z-10 transform-gpu blur-[52px] sm:-top-72" | ||
> | ||
<div | ||
style={{ | ||
clipPath: | ||
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)", | ||
}} | ||
className="relative aspect-[1155/678] w-[16.125rem] rotate-[30deg] bg-gradient-to-tr from-blue-500 to-purple-500 opacity-30 sm:w-[22.1875rem] md:-right-[0vw] lg:-right-[12vw] xl:-right-[20vw]" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Graphics; |
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