forked from hotosm/fmtm
-
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.
feat: project info legend (hotosm#1017)
* feat (projectInfo): map - legend added to map * fix (vectorLayer) - default style overriding setStyle if setStyle supplied stopped * fix (projectInfo): legend - legend header changed
- Loading branch information
1 parent
9610de1
commit c02c1fb
Showing
3 changed files
with
56 additions
and
3 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
38 changes: 38 additions & 0 deletions
38
src/frontend/src/components/ProjectInfo/ProjectInfoMapLegend.jsx
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,38 @@ | ||
import React from 'react'; | ||
|
||
const colorCodes = [ | ||
{ color: '#0062AC', min: 130, max: 160 }, | ||
{ color: '#4A90D9', min: 100, max: 130 }, | ||
{ color: '#7CB2E8', min: 50, max: 100 }, | ||
{ color: '#A9D2F3', min: 10, max: 50 }, | ||
{ color: '#FF4538', min: 0, max: 0 }, | ||
]; | ||
|
||
const LegendListItem = ({ code }) => ( | ||
<div className="fmtm-flex fmtm-items-center fmtm-gap-2"> | ||
<div style={{ backgroundColor: code.color }} className="fmtm-w-10 fmtm-h-6 fmtm-mx-2"></div> | ||
<div> | ||
{code.min !== code.max ? ( | ||
<p> | ||
{code.min} - {code.max} | ||
</p> | ||
) : ( | ||
<p>{code.min}</p> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
|
||
const ProjectInfoMapLegend = () => { | ||
return ( | ||
<div className="fmtm-py-3"> | ||
<div className="fmtm-flex fmtm-flex-col fmtm-gap-2 sm:fmtm-gap-4"> | ||
{colorCodes.map((code) => ( | ||
<LegendListItem key={code.color} code={code} /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProjectInfoMapLegend; |
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