From 18ba59997e4e168a09375715264c04d35396eb4a Mon Sep 17 00:00:00 2001 From: David Inga Date: Thu, 7 Mar 2024 10:25:20 +0100 Subject: [PATCH] added legend styles --- client/src/components/ui/popover.tsx | 22 ++++---- .../analysis-eudr/map/component.tsx | 4 +- .../analysis-eudr/map/legend/component.tsx | 51 +++++++++++++++++-- .../analysis-eudr/map/legend/item.tsx | 33 ++++++++++++ 4 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 client/src/containers/analysis-eudr/map/legend/item.tsx diff --git a/client/src/components/ui/popover.tsx b/client/src/components/ui/popover.tsx index bbba7e0eb..325d7b703 100644 --- a/client/src/components/ui/popover.tsx +++ b/client/src/components/ui/popover.tsx @@ -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, React.ComponentPropsWithoutRef ->(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( +>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( -)) -PopoverContent.displayName = PopoverPrimitive.Content.displayName +)); +PopoverContent.displayName = PopoverPrimitive.Content.displayName; -export { Popover, PopoverTrigger, PopoverContent } +export { Popover, PopoverTrigger, PopoverContent }; diff --git a/client/src/containers/analysis-eudr/map/component.tsx b/client/src/containers/analysis-eudr/map/component.tsx index 5aa2189c2..fc4ad8070 100644 --- a/client/src/containers/analysis-eudr/map/component.tsx +++ b/client/src/containers/analysis-eudr/map/component.tsx @@ -32,6 +32,8 @@ const EUDRMap = () => { autoHighlight: true, }); + const layers = [layer]; + const handleMapStyleChange = useCallback((newStyle: BasemapValue) => { setMapStyle(newStyle); }, []); @@ -52,7 +54,7 @@ const EUDRMap = () => { viewState={{ ...viewState }} onViewStateChange={({ viewState }) => setViewState(viewState as MapViewState)} controller={{ dragRotate: false }} - layers={[layer]} + layers={layers} > diff --git a/client/src/containers/analysis-eudr/map/legend/component.tsx b/client/src/containers/analysis-eudr/map/legend/component.tsx index 53c7d138e..54da03733 100644 --- a/client/src/containers/analysis-eudr/map/legend/component.tsx +++ b/client/src/containers/analysis-eudr/map/legend/component.tsx @@ -1,11 +1,16 @@ import { useState } from 'react'; import classNames from 'classnames'; +import { MinusIcon, PlusIcon } from '@heroicons/react/outline'; -import SandwichIcon from 'components/icons/sandwich'; +import LegendItem from './item'; + +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; +import SandwichIcon from '@/components/icons/sandwich'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; const EURDLegend = () => { const [isOpen, setIsOpen] = useState(false); + const [isExpanded, setIsExpanded] = useState(false); return (
@@ -14,14 +19,52 @@ const EURDLegend = () => { - - Place content for the popover here. + +
+

Legend

+
+ +
+ + +
+ +
+
+ + + + +
+
diff --git a/client/src/containers/analysis-eudr/map/legend/item.tsx b/client/src/containers/analysis-eudr/map/legend/item.tsx new file mode 100644 index 000000000..3946119f2 --- /dev/null +++ b/client/src/containers/analysis-eudr/map/legend/item.tsx @@ -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> = ({ + title, + description, + children, + iconClassName, +}) => { + return ( +
+
+
+
+

{title}

+
+
+

{description}

+ {children} +
+
+ ); +}; + +export default LegendItem;