-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Vizzuality/AF-legend
[FE](feat): legend
- Loading branch information
Showing
18 changed files
with
260 additions
and
221 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 |
---|---|---|
|
@@ -24,6 +24,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env | ||
.env.local | ||
|
||
# vercel | ||
.vercel | ||
|
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
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
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,12 +1,23 @@ | ||
import type { LayerProps } from '@/types/layers'; | ||
|
||
import { ProjectsLayer } from './projects/layer'; | ||
import { ProjectsLayer } from '@/containers/datasets/layers/projects/layer'; | ||
import ProjectsLegend from '@/containers/datasets/layers/projects/legend'; | ||
|
||
type LayersIndex = { | ||
[key: string]: React.ComponentType<LayerProps>; | ||
}; | ||
|
||
type LegendIndex = { | ||
[key: string]: React.ComponentType; | ||
}; | ||
|
||
// Define the LAYERS object with the explicit type | ||
export const LAYERS: LayersIndex = { | ||
projects: ProjectsLayer, | ||
'tree-cover': ProjectsLayer, | ||
}; | ||
|
||
export const LEGENDS: LegendIndex = { | ||
projects: ProjectsLegend, | ||
'tree-cover': ProjectsLegend, | ||
}; |
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,48 @@ | ||
import { CircleLayer } from 'mapbox-gl'; | ||
|
||
import { Settings } from '@/components/map/legend/types'; | ||
|
||
export function useLayers({ | ||
settings: { visibility = 'visible', opacity = 1 }, | ||
}: { | ||
settings: Settings; | ||
}) { | ||
return [ | ||
{ | ||
id: 'projects_points_shadow', | ||
type: 'circle', | ||
paint: { | ||
'circle-radius': 32, | ||
'circle-color': '#ccc', | ||
'circle-blur': 1, | ||
'circle-opacity': opacity, | ||
}, | ||
layout: { | ||
visibility: visibility, | ||
}, | ||
}, | ||
{ | ||
id: 'projects', | ||
type: 'circle', | ||
paint: { | ||
'circle-stroke-color': '#ffffff', | ||
'circle-stroke-width': ['case', ['boolean', ['feature-state', 'hover'], false], 3, 7], | ||
'circle-radius': ['case', ['boolean', ['feature-state', 'hover'], false], 13, 7], | ||
'circle-color': [ | ||
'case', | ||
['boolean', ['feature-state', 'hover'], false], | ||
'#EFB82A', | ||
'#176252', | ||
], | ||
'circle-opacity': opacity, | ||
}, | ||
transition: { | ||
duration: 300, | ||
delay: 0, | ||
}, | ||
layout: { | ||
visibility: visibility, | ||
}, | ||
}, | ||
] as CircleLayer[]; | ||
} |
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,3 @@ | ||
export default function Legend() { | ||
return <div className="h-3 w-3 rounded-full bg-green-500" />; | ||
} |
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
Oops, something went wrong.