-
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.
- Loading branch information
Showing
7 changed files
with
174 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
import React from 'react' | ||
|
||
const Sprint: React.FC = () => { | ||
return ( | ||
<div>Sprint</div> | ||
) | ||
} | ||
|
||
export default Sprint |
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 @@ | ||
import type { Sprint } from '@/types' | ||
import React from 'react' | ||
import { Separator } from "@/components/ui/separator" | ||
import { Ellipsis } from 'lucide-react'; import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from "@/components/ui/tooltip" | ||
|
||
type listPropType = { | ||
sprints: Sprint[] | ||
} | ||
|
||
const SprintList: React.FC<listPropType> = ({ sprints }) => { | ||
console.log(sprints); | ||
return ( | ||
<div className='w-full '> | ||
{sprints.map((sprint, i) => ( | ||
<div key={i}> | ||
<SingleSprint sprint={sprint} /> | ||
|
||
</div> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
export default SprintList; | ||
|
||
const SingleSprint: React.FC<{ sprint: Sprint }> = ({ sprint }) => { | ||
const formatDate = (date: string) => { | ||
const formattedDate = new Date(date); | ||
return formattedDate.toLocaleDateString('en-US', { | ||
month: 'short', | ||
day: '2-digit', | ||
year: 'numeric' | ||
}) | ||
}; | ||
|
||
const days = React.useMemo(() => { | ||
const calculateDays = (): number | null => { | ||
if (sprint?.end_date) { | ||
const today = new Date(); | ||
const end = new Date(sprint?.end_date); | ||
const diffInTime = end.getTime() - today.getTime(); | ||
const diffInDays = Math.ceil(diffInTime / (1000 * 3600 * 24) + 1); | ||
return diffInDays; | ||
} | ||
return null; | ||
}; | ||
return calculateDays(); | ||
}, [sprint?.end_date]); | ||
|
||
return ( | ||
<> | ||
<div className='text-black flex text-[14px] items-center mt-4 h-11 hover:bg-blue-50'> | ||
|
||
<div className='flex w-full items-center justify-between'> | ||
<div className='mx-4 pl-1'> | ||
{sprint?.name} | ||
</div> | ||
<div className='flex items-center gap-3 mr-7'> | ||
<div className='border rounded-sm px-1 h-fit w-fit bg-[#e9ece5] border-gray-300'> | ||
<h3 className='text-[12px]'> | ||
{formatDate(sprint?.start_date)} 🡒 {formatDate(sprint?.end_date)} | ||
</h3> | ||
</div> | ||
<div className='border-yellow-500 text-[11px] border bg-[#ffe5a3] rounded-sm px-[6px]'>{days} days left</div> | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger className="bg-blue-500 h-6 w-6 cursor-pointer rounded-full"> | ||
<h5 className="text-center text-white text-[12px] pt-[1px]">HS</h5> | ||
</TooltipTrigger> | ||
<TooltipContent> | ||
<p>Creator</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
<Ellipsis className='h-6 w-8' /> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
<Separator /> | ||
|
||
</>) | ||
} |
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,28 @@ | ||
import * as React from "react" | ||
import * as TooltipPrimitive from "@radix-ui/react-tooltip" | ||
|
||
import { cn } from "@/lib/utils" | ||
|
||
const TooltipProvider = TooltipPrimitive.Provider | ||
|
||
const Tooltip = TooltipPrimitive.Root | ||
|
||
const TooltipTrigger = TooltipPrimitive.Trigger | ||
|
||
const TooltipContent = React.forwardRef< | ||
React.ElementRef<typeof TooltipPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> | ||
>(({ className, sideOffset = 4, ...props }, ref) => ( | ||
<TooltipPrimitive.Content | ||
ref={ref} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"z-50 overflow-hidden rounded-md border bg-popover px-2 py-1 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
TooltipContent.displayName = TooltipPrimitive.Content.displayName | ||
|
||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } |