Skip to content

Commit

Permalink
style: light mode
Browse files Browse the repository at this point in the history
also round off the calendar
  • Loading branch information
makinbacon21 committed Nov 19, 2024
1 parent 043bb0c commit 4aa5b03
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 65 deletions.
37 changes: 19 additions & 18 deletions components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export default function Calendar({
function renderEventContent(eventInfo: EventContentArg) {
return (
<Card
className="fc-event-main-frame w-[100%] rounded-md group min-h-0 hover:min-h-28 ease-in-out px-1 z-0 hover:z-10 hover:transition-all duration-700 "
style={{ backgroundColor: eventInfo.event.extendedProps.daColor }}
className={`fc-event-main-frame w-[100%] rounded-md group min-h-0 hover:min-h-28 ease-in-out px-1 z-0 hover:z-10 hover:transition-all duration-700 text-white ${eventInfo.event.extendedProps.daColor}`}
>
<b className="font-sans text-[10px] font-normal">
{eventInfo.timeText} {"|"} {eventInfo.event.extendedProps.room}
Expand All @@ -46,21 +45,23 @@ export default function Calendar({
}

return (
<FullCalendar
expandRows
allDaySlot={false}
dayHeaderContent={dayHeaderContent}
editable={false}
eventContent={renderEventContent}
events={events}
headerToolbar={false}
height="100%"
initialView="timeGridWeek"
plugins={[timeGridPlugin]}
slotDuration="01:00:00"
slotMaxTime={endTime}
slotMinTime={startTime}
weekends={false}
/>
<div className="bg-primary dark:bg-transparent w-full h-full rounded-lg">
<FullCalendar
expandRows
allDaySlot={false}
dayHeaderContent={dayHeaderContent}
editable={false}
eventContent={renderEventContent}
events={events}
headerToolbar={false}
height="100%"
initialView="timeGridWeek"
plugins={[timeGridPlugin]}
slotDuration="01:00:00"
slotMaxTime={endTime}
slotMinTime={startTime}
weekends={false}
/>
</div>
);
}
17 changes: 8 additions & 9 deletions components/CourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export default function CourseCard(props: any) {
className="flex w-6 h-6 lg:w-8 lg:h-8 rounded-md justify-center items-center"
style={{ backgroundColor: color_mappings[index] }}
>
<p className="font-bold text-sm lg:text-base text-white">{item[0]}</p>
<p className="font-bold text-sm lg:text-base text-black dark:text-white">
{item[0]}
</p>
</div>
);
}
Expand All @@ -80,10 +82,7 @@ export default function CourseCard(props: any) {

return (
<Card key={props.course.id} isHoverable className={base()} shadow="sm">
<div
className="absolute top-0 left-0 h-full w-2"
style={{ backgroundColor: color }}
/>
<div className={`absolute top-0 left-0 h-full w-2 ${color}`} />
<CardHeader className="pl-6" onClick={() => updatePlan(props.course)}>
<div className="flex items-center flex-row justify-between w-full">
<div className="flex flex-col">
Expand Down Expand Up @@ -124,12 +123,12 @@ export default function CourseCard(props: any) {
<div className="flex justify-between flex-row gap-3">
<div className="gap-4 basis-1/2">
{props.course.facultyMeet.meetingTimes.room ? (
<div className="bg-[#2C2C33] py-1 px-2 lg:py-2 lg:px-3 w-auto max-w-64 rounded-md">
<div className="bg-background_layer shadow-md py-1 px-2 lg:py-2 lg:px-3 w-auto max-w-64 rounded-md">
<div className="font-semibold text-sm lg:text-lg text-white">
{props.course.facultyMeet.meetingTimes.buildingDescription}{" "}
{props.course.facultyMeet.meetingTimes.room}
</div>
<div className="text-sm lg:text-base">
<div className="text-sm lg:text-base text-white">
{props.course.facultyMeet.meetingTimes ? (
<div className="mt-1">
<div className="font-normal">
Expand Down Expand Up @@ -157,8 +156,8 @@ export default function CourseCard(props: any) {
</div>
</div>
) : (
<div className="bg-[#2C2C33] py-2 px-3 w-auto max-w-64 rounded-md">
<p className="text-sm lg:text-base">
<div className="bg-background_layer shadow-md py-2 px-3 w-auto max-w-64 rounded-md">
<p className="text-sm lg:text-base text-white">
Contact your Professor for additional details.
</p>
</div>
Expand Down
5 changes: 1 addition & 4 deletions components/CreatePlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ export default function CreatePlan(props: any) {
// onClick={() => removeCourseFromPlan(selectedCoursePlan, course)}
>
<div
className={`absolute top-0 left-0 h-full w-2 rounded-full`}
style={{
backgroundColor: generateColorFromName(course.subject),
}}
className={`absolute top-0 left-0 h-full w-2 rounded-full ${generateColorFromName(course.subject)}`}
/>

<CardHeader className="justify-between">
Expand Down
7 changes: 2 additions & 5 deletions components/PlanCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export default function PlanCard(props: any) {
shadow="sm"
>
<div
className={`absolute top-0 left-0 h-full w-2 rounded-full`}
style={{
backgroundColor: generateColorFromName(props.course.subject),
}}
className={`absolute top-0 left-0 h-full w-2 rounded-full ${generateColorFromName(props.course.subject)}`}
/>

<CardHeader className="justify-between ">
Expand All @@ -31,7 +28,7 @@ export default function PlanCard(props: any) {
onClick={() =>
removeCourseFromPlan(props.selectedCoursePlan[0], props.course)
}
*/
>
X
Expand Down
3 changes: 3 additions & 0 deletions components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ export default function Search(props: any) {
<Input
isClearable
className="col-span-9 lg:col-span-3"
classNames={{
inputWrapper: ["border-primary", "border-[0.5px]"],
}}
defaultValue={searchParams.get("query")?.toString()}
label="Search"
labelPlacement="inside"
Expand Down
19 changes: 13 additions & 6 deletions components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const Navbar = (props: any) => {
return (
<div className="bg-background_navbar h-auto">
<NextUINavbar
classNames={{
toggleIcon: ["text-white"],
}}
className="bg-inherit lg:py-2"
maxWidth="full"
position="sticky"
Expand All @@ -73,7 +76,7 @@ export const Navbar = (props: any) => {
<span className={title({ size: "sm", color: "logo" })}>
SCCS&nbsp;
</span>
<span className={title({ size: "xs" })}>
<span className={title({ size: "xs" }) + " text-white"}>
Course Planner&nbsp;
</span>
</NextLink>
Expand Down Expand Up @@ -114,8 +117,11 @@ export const Navbar = (props: any) => {
{status === "authenticated" ? (
<Dropdown>
<DropdownTrigger>
<Button variant="bordered">
<AccountCircleIcon />
<Button
variant="bordered"
className="text-primary border-primary"
>
<AccountCircleIcon className="fill-primary" />
{session.user?.name || "Account"}
</Button>
</DropdownTrigger>
Expand All @@ -133,8 +139,9 @@ export const Navbar = (props: any) => {
<Button
variant="bordered"
onClick={() => signIn("keycloak", { callbackUrl: "/" })}
className="border-primary"
>
<InputIcon /> Log In
<InputIcon className="fill-white text-primary" /> Log In
</Button>
)}
</NavbarItem>
Expand Down Expand Up @@ -169,7 +176,7 @@ export const Navbar = (props: any) => {
<Dropdown>
<DropdownTrigger>
<Button variant="bordered">
<AccountCircleIcon />
<AccountCircleIcon className="fill-white" />
{session.user?.name || "Account"}
</Button>
</DropdownTrigger>
Expand All @@ -188,7 +195,7 @@ export const Navbar = (props: any) => {
variant="bordered"
onClick={() => signIn("keycloak", { callbackUrl: "/" })}
>
<InputIcon /> Log In
<InputIcon className="fill-white text-primary" /> Log In
</Button>
)}
</NavbarItem>
Expand Down
35 changes: 19 additions & 16 deletions components/primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ export const subtitle = tv({
});

export const courseColors = [
"hsl(0deg 60% 35%)",
"hsl(21.17deg 60% 35%)",
"hsl(42.34deg 60% 35%)",
"hsl(63.51deg 60% 35%)",
"hsl(84.68deg 60% 35%)",
"hsl(105.85deg 60% 35%)",
"hsl(127.02deg 60% 35%)",
"hsl(148.19deg 60% 35%)",
"hsl(169.36deg 60% 35%)",
"hsl(190.53deg 60% 35%)",
"hsl(211.70deg 60% 35%)",
"hsl(232.87deg 60% 35%)",
"hsl(254.04deg 60% 35%)",
"hsl(275.21deg 60% 35%)",
"hsl(296.38deg 60% 35%)",
"hsl(317.55deg 60% 35%)",
"bg-[color:hsl(0deg_60%_50%)] dark:bg-[color:hsl(0deg_60%_35%)]",
"bg-[color:hsl(21.17deg_60%_50%)] dark:bg-[color:hsl(21.17deg_60%_35%)]",
"bg-[color:hsl(42.34deg_60%_50%)] dark:bg-[color:hsl(42.34deg_60%_35%)]",
"bg-[color:hsl(63.51deg_60%_50%)] dark:bg-[color:hsl(63.51deg_60%_35%)]",
"bg-[color:hsl(84.68deg_60%_50%)] dark:bg-[color:hsl(84.68deg_60%_35%)]",
"bg-[color:hsl(105.85deg_60%_50%)] dark:bg-[color:hsl(105.85deg_60%_35%)]",
"bg-[color:hsl(127.02deg_60%_50%)] dark:bg-[color:hsl(127.02deg_60%_35%)]",
"bg-[color:hsl(148.19deg_60%_50%)] dark:bg-[color:hsl(148.19deg_60%_35%)]",
"bg-[color:hsl(169.36deg_60%_50%)] dark:bg-[color:hsl(169.36deg_60%_35%)]",
"bg-[color:hsl(190.53deg_60%_50%)] dark:bg-[color:hsl(190.53deg_60%_35%)]",
"bg-[color:hsl(211.70deg_60%_50%)] dark:bg-[color:hsl(211.70deg_60%_35%)]",
"bg-[color:hsl(232.87deg_60%_50%)] dark:bg-[color:hsl(232.87deg_60%_35%)]",
"bg-[color:hsl(254.04deg_60%_50%)] dark:bg-[color:hsl(254.04deg_60%_35%)]",
"bg-[color:hsl(275.21deg_60%_50%)] dark:bg-[color:hsl(275.21deg_60%_35%)]",
"bg-[color:hsl(296.38deg_60%_50%)] dark:bg-[color:hsl(296.38deg_60%_35%)]",
"bg-[color:hsl(317.55deg_60%_50%)] dark:bg-[color:hsl(317.55deg_60%_35%)]",
];

export function generateColorFromName(name: string) {
Expand All @@ -81,5 +81,8 @@ export function generateColorFromName(name: string) {
hash += name.charCodeAt(i) * i;
}

console.log("generated:");
console.log(courseColors[hash % courseColors.length]);

return courseColors[hash % courseColors.length];
}
10 changes: 7 additions & 3 deletions components/theme-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const ThemeSwitch: FC<ThemeSwitchProps> = ({
className: clsx(
"px-px transition-opacity hover:opacity-80 cursor-pointer",
className,
classNames?.base,
classNames?.base
),
})}
>
Expand All @@ -65,11 +65,15 @@ export const ThemeSwitch: FC<ThemeSwitchProps> = ({
"px-0",
"mx-0",
],
classNames?.wrapper,
classNames?.wrapper
),
})}
>
{!isSelected || isSSR ? <Brightness4Icon /> : <BedtimeIcon />}
{!isSelected || isSSR ? (
<Brightness4Icon className="fill-primary" />
) : (
<BedtimeIcon className="fill-primary" />
)}
</div>
</Component>
);
Expand Down
16 changes: 14 additions & 2 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
.fc-col-header {
background-color: #151d2b;
font-family: var(--font-sans);
border-radius: 0.5rem 0.5rem 0px 0px;
}

.fc {
border-radius: 0.5rem;
}

.fc-event-main-frame {
Expand All @@ -50,8 +55,15 @@
text-overflow: ellipsis;
}

h2 {
font-size: 1.1em;
.fc-theme-standard .fc-scrollgrid {
border-radius: 0.5rem;
}

.fc-theme-standard td {
border-radius: 0rem 0rem 0.5rem 0.5rem;
}
.fc-theme-standard th {
border-radius: 0.5rem 0.5rem 0rem 0rem;
}

.smallFont {
Expand Down
19 changes: 17 additions & 2 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,34 @@ module.exports = {
plugins: [
nextui({
themes: {
light: {},
light: {
colors: {
background: "#E5E7EB",
background_navbar: "#31425E",
background_layer: "#31425E",
foreground: "#000000",
light_foreground: "#F1F1F1",
primary: {
DEFAULT: "#9FADBC",
foreground: "#314f25E",
},
secondary: "#F46523",
focus: "#F46523",
},
},
dark: {
colors: {
background: "#0C1019",
background_navbar: "#151D2B",
background_layer: "#2C2C33",
foreground: "#D9D9D9",
light_foreground: "#181C25",
primary: {
DEFAULT: "#9FADBC",
foreground: "#1D2125",
},
secondary: "#F46523",
focus: "#BEF264",
focus: "#F46523",
},
},
},
Expand Down

0 comments on commit 4aa5b03

Please sign in to comment.