Skip to content

Commit

Permalink
Create initial Course Card
Browse files Browse the repository at this point in the history
  • Loading branch information
DCRepublic committed Oct 1, 2024
1 parent 4d3dd5e commit 008bef8
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 71 deletions.
13 changes: 8 additions & 5 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"use client";

import { CourseBig } from "@/components/course-big";
export default function Home() {
return (
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
<div className="inline-block max-w-xl text-center justify-center" />

<div className="flex gap-3" />
</section>
<div className="grid gap-4 max-h-8/12 overflow-scroll w-7/12">
<CourseBig color="bg-red-500" />
<CourseBig color="bg-yellow-500" />
<CourseBig color="bg-green-500" />
</div>
);
}
91 changes: 91 additions & 0 deletions components/course-big.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"use client";
import { Card, CardBody } from "@nextui-org/react";
import { tv } from "tailwind-variants";

export const card = tv({
slots: {
base: "bg-light_foreground min-h-40 max-h-96 w-full rounded-sm",
avatar:
"w-24 h-24 md:w-48 md:h-auto md:rounded-none rounded-full mx-auto drop-shadow-lg",
wrapper: "flex-1 pt-6 md:p-8 text-center md:text-left space-y-4",
description: "text-md font-medium ",
infoWrapper: "font-medium",
name: "text-sm text-sky-500 dark:text-sky-400",
role: "font-bold text-primary ",
sideColor: "w-2 h-full bg-red-500",
},
variants: {
color: {
violet: "from-[#FF1CF7] to-[#b249f8]",
yellow: "from-[#FF705B] to-[#FFB457]",
blue: "from-[#5EA2EF] to-[#0072F5]",
cyan: "from-[#00b7fa] to-[#01cfea]",
green: "from-[#6FEE8D] to-[#17c964]",
pink: "from-[#FF72E1] to-[#F54C7A]",
logo: "from-[#333C44] to-[#9FADBC]",
foreground: "dark:from-[#FFFFFF] dark:to-[#4B4B4B]",
},
},
});

const {
base,
avatar,
wrapper,
description,
infoWrapper,
name,
role,
sideColor,
} = card();

export const CourseBig = (props: any) => {
return (
<Card className={base()} shadow="sm">
<div
className={`absolute top-0 left-0 h-full w-3 ${props.color} rounded-full`}
/>
<CardBody className="ml-4 ">
<div className="grid grid-cols-4 gap-0 ">
<div className="content-center">
<p className={role()}>Course</p>
<div className="text-xs mt-2 ">Econ 02 A | 1 credit(s)</div>
<div className="text-xs ">Intermediate Economics</div>
<div className="text-xs ">20008</div>
</div>
<div className="grid-rows-2 grid-cols-1 space-y-10 ">
<div>
<p className={role()}>Availability</p>
<div className="text-xs mt-2">20/31</div>
</div>
<div className="mt-2">
<p className={role()}>Attributes</p>
<div className="text-xs ">SS</div>
</div>
</div>

<div className="grid-rows-2 grid-cols-1 space-y-10">
<div>
<p className={role()}>Days</p>
<div className="text-xs mt-2">M, W, F</div>
</div>
<div className="mt-2">
<p className={role()}>Time</p>
<div className="text-xs ">11:20 am - 12:35 pm</div>
</div>
</div>
<div className="grid-rows-2 grid-cols-1 space-y-10">
<div>
<p className={role()}>Instructor</p>
<div className="text-xs mt-2">Olivero, Maria Pia</div>
</div>
<div className="mt-2">
<p className={role()}>Room</p>
<div className="text-xs ">Science Center 104</div>
</div>
</div>
</div>
</CardBody>
</Card>
);
};
155 changes: 89 additions & 66 deletions components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { Spacer } from "@nextui-org/spacer";
import NextLink from "next/link";
import { usePathname } from "next/navigation";
import { button as buttonStyles } from "@nextui-org/theme";
import { Divider } from "@nextui-org/divider";
import InputIcon from "@mui/icons-material/Input";

import { siteConfig } from "@/config/site";
import { ThemeSwitch } from "@/components/theme-switch";
Expand Down Expand Up @@ -46,75 +48,96 @@ export const Navbar = () => {
);

return (
<NextUINavbar className="mt-10" maxWidth="xl" position="sticky">
<NavbarContent className="basis-1/5 sm:basis-full" justify="start">
<NavbarBrand as="li" className="gap-3 max-w-fit">
<NextLink className="flex justify-start items-center gap-1" href="/">
<span className={title({ size: "sm", color: "logo" })}>
SCCS&nbsp;
</span>
<span className={title({ size: "xs" })}>Course Planner&nbsp;</span>
</NextLink>
</NavbarBrand>
</NavbarContent>
<>
<NextUINavbar className="mt-10" maxWidth="xl" position="sticky">
<NavbarContent className="basis-1/5 sm:basis-full" justify="start">
<NavbarBrand as="li" className="gap-3 max-w-fit">
<NextLink
className="flex justify-start items-center gap-1"
href="/"
>
<span className={title({ size: "sm", color: "logo" })}>
SCCS&nbsp;
</span>
<span className={title({ size: "xs" })}>
Course Planner&nbsp;
</span>
</NextLink>
</NavbarBrand>
</NavbarContent>

<NavbarContent justify="start">
<Spacer x={24} />
<ul className="hidden lg:flex gap-4 justify-start ml-2">
{siteConfig.navItems.map((item) => (
<>
<Link
key={item.href}
className={buttonStyles({
color: "primary",
radius: "full",
variant: pathname == item.href ? "shadow" : "ghost",
})}
href={item.href}
>
{item.label}
</Link>
</>
))}
</ul>
</NavbarContent>
<NavbarContent justify="start">
<Spacer x={24} />
<ul className="hidden lg:flex gap-4 justify-start ml-2">
{siteConfig.navItems.map((item) => (
<>
<Link
key={item.href}
className={buttonStyles({
color: "primary",
radius: "full",
variant: pathname == item.href ? "shadow" : "ghost",
})}
href={item.href}
>
{item.label}
</Link>
</>
))}
</ul>
</NavbarContent>

<NavbarContent
className="hidden sm:flex basis-1/5 sm:basis-full"
justify="end"
>
<NavbarItem className="hidden sm:flex gap-2">
<ThemeSwitch />
</NavbarItem>
</NavbarContent>
<NavbarContent
className="hidden sm:flex basis-1/5 sm:basis-full"
justify="end"
>
<NavbarItem className="hidden sm:flex gap-2">
<ThemeSwitch />
</NavbarItem>
<NavbarItem>
<Link
className={buttonStyles({
color: "primary",
radius: "full",
variant: "ghost",
})}
href=""
>
Sign In <InputIcon />
</Link>
</NavbarItem>
</NavbarContent>

<NavbarContent className="sm:hidden basis-1 pl-4" justify="end">
<ThemeSwitch />
<NavbarMenuToggle />
</NavbarContent>
<NavbarContent className="sm:hidden basis-1 pl-4" justify="end">
<ThemeSwitch />
<NavbarMenuToggle />
</NavbarContent>

<NavbarMenu>
{searchInput}
<div className="mx-4 mt-2 flex flex-col gap-2">
{siteConfig.navMenuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
color={
index === 2
? "primary"
: index === siteConfig.navMenuItems.length - 1
? "danger"
: "foreground"
}
href="#"
size="lg"
>
{item.label}
</Link>
</NavbarMenuItem>
))}
</div>
</NavbarMenu>
</NextUINavbar>
{/* Mobile?*/}
<NavbarMenu>
{searchInput}
<div className="mx-4 mt-2 flex flex-col gap-2">
{siteConfig.navMenuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
color={
index === 2
? "primary"
: index === siteConfig.navMenuItems.length - 1
? "danger"
: "foreground"
}
href="#"
size="lg"
>
{item.label}
</Link>
</NavbarMenuItem>
))}
</div>
</NavbarMenu>
</NextUINavbar>
<Divider className="my-4" />
</>
);
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"lint": "eslint . --ext .ts,.tsx -c .eslintrc.json --fix"
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^6.1.1",
"@nextui-org/button": "2.0.38",
"@nextui-org/code": "2.0.33",
"@nextui-org/input": "2.2.5",
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
colors: {
background: "#1D2125",
foreground: "#D9D9D9",
light_foreground: "#282D34",
primary: {
DEFAULT: "#9FADBC",
foreground: "#1D2125",
Expand Down

0 comments on commit 008bef8

Please sign in to comment.