FIXED CALENDAR FULL HEIGHT!!

This commit is contained in:
2024-06-18 20:30:19 -04:00
parent 7373c5e19e
commit 7b257420cf
3 changed files with 98 additions and 83 deletions
+18 -9
View File
@@ -3,7 +3,7 @@ import { VariantProps, cva } from "class-variance-authority";
import React from "react"; import React from "react";
const CalenderItemVariants = cva( const CalenderItemVariants = cva(
"rounded-sm cursor-pointer bg-opacity-15 hover:bg-opacity-70", "rounded-sm cursor-pointer bg-opacity-15 hover:bg-opacity-40",
{ {
variants: { variants: {
variant: { variant: {
@@ -11,12 +11,12 @@ const CalenderItemVariants = cva(
conference: "bg-yellow-300 text-yellow-300", conference: "bg-yellow-300 text-yellow-300",
dividend: "bg-blue-500 text-blue-500", dividend: "bg-blue-500 text-blue-500",
earnings: "bg-green-500 text-green-500", earnings: "bg-green-500 text-green-500",
event: "bg-violet-500 text-violet-500", event: "bg-purple-500 text-purple-500",
split: "bg-pink-500 text-pink-500", split: "bg-pink-500 text-pink-500",
}, },
size: { size: {
sm: "whitespace-nowrap", sm: "whitespace-nowrap",
lg: "min-h-16", lg: "bg-opacity-5",
}, },
}, },
defaultVariants: { defaultVariants: {
@@ -54,14 +54,23 @@ const CalendarItem = ({
"w-1 rounded-full bg-opacity-100" "w-1 rounded-full bg-opacity-100"
)} )}
/> />
<div className="flex gap-1 justify-between px-1 w-full"> <div
<p>{title}</p> className={cn(size == "lg" && "flex flex-col px-1 gap-2", "w-full")}
<p className={cn(size == "sm" ? "hidden xl:block" : "", "")}> >
{time} <div className="flex gap-1 justify-between px-1 w-full">
</p> <p>{title}</p>
<p className={cn(size == "sm" ? "hidden xl:block" : "", "")}>
{time}
</p>
</div>
{description && (
<p className="p-1 font-light leading-snug line-clamp-4 text-justify">
{description}
</p>
)}
</div> </div>
</div> </div>
{description && <p className="p-1 font-light">{description}</p>} <div></div>
</div> </div>
); );
}; };
+4 -2
View File
@@ -30,7 +30,7 @@ const Day = () => {
variant="earnings" variant="earnings"
size="lg" size="lg"
time="BMO" time="BMO"
description="Nvidia is reporting earnings after a boom in AI. " description="Nvidia is reporting earnings after a boom in AI. Nvidia has emerged as a major player driving advancements in artificial intelligence. The company's high-performance graphics processing units (GPUs) have become the workhorses powering many of the latest AI models and applications. In 2023, Nvidia doubled down on AI with the launch of its Hopper architecture - a new chip design optimized for transformer-based language models like GPT-3. They also introduced new AI software tools and services through their Nvidia AI platform. This includes pre-trained models, development frameworks, and cloud services for enterprises looking to deploy large language models and computer vision AI. Additionally, Nvidia has been at the forefront of accelerating AI computing through innovations like their Grace CPU designed for AI/ML workloads. As generative AI goes mainstream, Nvidia's chips and software are becoming critical infrastructure enabling everything from content creation to drug discovery using advanced machine learning techniques."
/> />
<CalendarItem <CalendarItem
title="NVDA Split 10:1" title="NVDA Split 10:1"
@@ -43,7 +43,9 @@ const Day = () => {
variant="conference" variant="conference"
size="lg" size="lg"
time="9 am" time="9 am"
description="Apple is holding a conference call to update shareholders about it's recent AI WWDC event." description="Apple has been ramping up its artificial intelligence efforts in recent years. At its Worldwide Developers Conference (WWDC) in June 2023, the company unveiled several new AI-powered features across its software platforms. This includes an enhanced Siri assistant with improved language understanding and multitasking capabilities. Apple also introduced Visioneer, a new AI model for advanced computer vision tasks like image analysis and video processing. Additionally, the company has been working on implementing generative AI models into its productivity apps like Pages and Keynote to assist with content creation. While Apple has historically been more cautious about adopting cutting-edge AI compared to rivals, these latest moves signal their intent to double down on machine learning and AI across their product ecosystem.
"
/> />
</div> </div>
</div> </div>
+76 -72
View File
@@ -36,7 +36,7 @@ const MonthCalendar = () => {
return ( return (
<Tabs className="w-full h-full overflow-hidden" defaultValue="month"> <Tabs className="w-full h-full overflow-hidden" defaultValue="month">
<Card> <Card className="flex flex-col">
<CardHeader className="p-2"> <CardHeader className="p-2">
<div className="grid grid-cols-3 justify-stretch items-center"> <div className="grid grid-cols-3 justify-stretch items-center">
<div className="place-self-start"> <div className="place-self-start">
@@ -79,79 +79,83 @@ const MonthCalendar = () => {
{/* MONTH VIEW */} {/* MONTH VIEW */}
{calendarView == "month" && ( {calendarView == "month" && (
<CardContent className="p-0"> <CardContent className="p-0 h-full flex">
<div className="grid grid-cols-7 h-10"> <div className="flex flex-col w-full">
{sevenDays.map((day) => ( <div className="grid grid-cols-7 h-10">
<div {sevenDays.map((day) => (
className="border-t border-neutral-700 flex items-center justify-center text-muted-foreground" <div
key={day} className="border-t border-neutral-700 flex items-center justify-center text-muted-foreground"
> key={day}
{day} >
</div> {day}
))}
</div>
<div className="grid grid-cols-7 grid-rows-6 h-full">
{dates.map((item, index) => (
<div
key={index}
className={cn(
// isWeekend(item.date) ? "bg-muted" : "",
isSunday(item.date) ? "border border-l-0" : "border",
isSameMonth(item.date, new Date()) ? "" : "bg-muted",
"border-neutral-700 flex flex-col border-b-0 border-r-0"
)}
>
<div className="p-2 pb-0">
<p
className={cn(
isToday(item.date) ? "bg-red-600" : "",
"font-bold rounded-full w-6 flex justify-center"
)}
>
{format(item.date, "d", { timeZone: "America/New_York" })}
</p>
</div> </div>
<div className="grid grid-rows-4 overflow-hidden gap-1 p-1 px-2"> ))}
{item.events.length < 4 </div>
? item.events.map((event: any, eventkey: number) => ( <div className="grid grid-cols-7 grid-rows-6 h-full">
<CalendarItem {dates.map((item, index) => (
time={event.time} <div
title={event.title} key={index}
key={eventkey} className={cn(
variant={ // isWeekend(item.date) ? "bg-muted" : "",
isSameMonth(item.date, new Date()) isSunday(item.date) ? "border border-l-0" : "border",
? event.variant isSameMonth(item.date, new Date()) ? "" : "bg-muted",
: "default" "border-neutral-700 flex flex-col border-b-0 border-r-0"
} )}
size="sm" >
/> <div className="p-2 pb-0">
)) <p
: [ className={cn(
...item.events isToday(item.date) ? "bg-red-600" : "",
.slice(0, 3) "font-bold rounded-full w-6 flex justify-center"
.map((event: any, eventkey: number) => ( )}
<CalendarItem >
time={event.time} {format(item.date, "d", {
variant={ timeZone: "America/New_York",
isSameMonth(item.date, new Date()) })}
? event.variant </p>
: "default" </div>
} <div className="grid grid-rows-4 overflow-hidden gap-1 p-1 px-2">
title={event.title} {item.events.length < 4
key={eventkey} ? item.events.map((event: any, eventkey: number) => (
size="sm" <CalendarItem
/> time={event.time}
)), title={event.title}
<CalendarItem key={eventkey}
title={`+ ${item.events.length - 3} more`} variant={
key="end" isSameMonth(item.date, new Date())
size="sm" ? event.variant
variant="default" : "default"
/>, }
]} size="sm"
/>
))
: [
...item.events
.slice(0, 3)
.map((event: any, eventkey: number) => (
<CalendarItem
time={event.time}
variant={
isSameMonth(item.date, new Date())
? event.variant
: "default"
}
title={event.title}
key={eventkey}
size="sm"
/>
)),
<CalendarItem
title={`+ ${item.events.length - 3} more`}
key="end"
size="sm"
variant="default"
/>,
]}
</div>
</div> </div>
</div> ))}
))} </div>
</div> </div>
</CardContent> </CardContent>
)} )}