-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
4f4134a
commit 18ba599
Showing
4 changed files
with
94 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import * as React from "react" | ||
import * as PopoverPrimitive from "@radix-ui/react-popover" | ||
import * as React from 'react'; | ||
import * as PopoverPrimitive from '@radix-ui/react-popover'; | ||
|
||
import { cn } from "@/lib/utils" | ||
import { cn } from '@/lib/utils'; | ||
|
||
const Popover = PopoverPrimitive.Root | ||
const Popover = PopoverPrimitive.Root; | ||
|
||
const PopoverTrigger = PopoverPrimitive.Trigger | ||
const PopoverTrigger = PopoverPrimitive.Trigger; | ||
|
||
const PopoverContent = React.forwardRef< | ||
React.ElementRef<typeof PopoverPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> | ||
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( | ||
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( | ||
<PopoverPrimitive.Portal> | ||
<PopoverPrimitive.Content | ||
ref={ref} | ||
align={align} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 | ||
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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} | ||
/> | ||
</PopoverPrimitive.Portal> | ||
)) | ||
PopoverContent.displayName = PopoverPrimitive.Content.displayName | ||
)); | ||
PopoverContent.displayName = PopoverPrimitive.Content.displayName; | ||
|
||
export { Popover, PopoverTrigger, PopoverContent } | ||
export { Popover, PopoverTrigger, PopoverContent }; |
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,33 @@ | ||
import classNames from 'classnames'; | ||
|
||
import type { FC, PropsWithChildren } from 'react'; | ||
|
||
type LegendItemProps = { title: string; description: string; iconClassName?: string }; | ||
|
||
const LegendItem: FC<PropsWithChildren<LegendItemProps>> = ({ | ||
title, | ||
description, | ||
children, | ||
iconClassName, | ||
}) => { | ||
return ( | ||
<div className="flex space-x-2 p-4"> | ||
<div | ||
className={classNames( | ||
'mt-0.5 h-3 w-3 shrink-0', | ||
iconClassName ?? 'border-2 border-gray-500 bg-gray-500/30', | ||
)} | ||
/> | ||
<div className="flex-1 space-y-1"> | ||
<div> | ||
<h3 className="text-xs font-normal">{title}</h3> | ||
<div></div> | ||
</div> | ||
<p className="text-xs text-gray-500">{description}</p> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LegendItem; |