Skip to content

Commit

Permalink
Merge pull request #82 from Vizzuality/SKY30-158-add-legend-to-establ…
Browse files Browse the repository at this point in the history
…ishment

[SKY30-158]: establishment legend
  • Loading branch information
andresgnlez authored Nov 27, 2023
2 parents 24e2a6e + da073c2 commit 45f0d2d
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Icon from '@/components/ui/icon';
import DesignatedIcon from '@/styles/icons/designated.svg?sprite';
import ImplementedIcon from '@/styles/icons/implemented.svg?sprite';
import ManagedIcon from '@/styles/icons/managed.svg?sprite';
import ProposedIcon from '@/styles/icons/proposed.svg?sprite';

const ITEM_LIST_CLASSES = 'flex items-center space-x-2';
const ICON_CLASSES = 'h-7 w-7 border border-black rounded-full';

const PATTERNS = {
proposed: ProposedIcon,
managed: ManagedIcon,
designated: DesignatedIcon,
implemented: ImplementedIcon,
};

const EEZLayerLegend = (config: { items: { label: string; pattern: string }[] }) => {
const { items } = config;

return (
<ul className="space-y-3 font-mono text-xs">
{items.map(({ label, pattern }) => (
<li key={pattern} className={ITEM_LIST_CLASSES}>
<Icon icon={PATTERNS[pattern]} className={ICON_CLASSES} />
<span>{label}</span>
</li>
))}
</ul>
);
};

export default EEZLayerLegend;
2 changes: 2 additions & 0 deletions frontend/src/lib/json-converter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { JSONConfiguration, JSONConverter } from '@deck.gl/json/typed';
// LegendTypeGradient,
// } from '@/components/map/legend/item-types';
import EEZLayerLegend from '@/containers/data-tool/content/map/layers-toolbox/legend/eez';
import EstablishmentLayerLegend from '@/containers/data-tool/content/map/layers-toolbox/legend/establishment';
import EEZLayerPopup from '@/containers/data-tool/content/map/popup/eez';
import GenericPopup from '@/containers/data-tool/content/map/popup/generic';
import ProtectedAreaPopup from '@/containers/data-tool/content/map/popup/protected-area';
Expand All @@ -30,6 +31,7 @@ export const JSON_CONFIGURATION = new JSONConfiguration({
EEZLayerLegend,
GenericPopup,
ProtectedAreaPopup,
EstablishmentLayerLegend,
// LegendTypeBasic,
// LegendTypeChoropleth,
// LegendTypeGradient,
Expand Down
46 changes: 46 additions & 0 deletions frontend/src/styles/icons/designated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions frontend/src/styles/icons/implemented.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 45f0d2d

Please sign in to comment.