-
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.
- Loading branch information
Showing
5 changed files
with
69 additions
and
55 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,51 +1,50 @@ | ||
'use-client'; | ||
|
||
import type { Layer } from '@/types/generated/strapi.schemas'; | ||
import type { LayerSettings } from '@/types/layers'; | ||
import type { Legend } from '@/types/map'; | ||
|
||
import LegendSettings from '@/containers/legend-settings'; | ||
|
||
const BasicLegendItem = ({ | ||
name, | ||
legend_config, | ||
settings, | ||
items, | ||
notes, | ||
}: { | ||
name: Legend['name']; | ||
settings: LayerSettings; | ||
items: Legend['items']; | ||
notes?: Legend['notes']; | ||
}) => ( | ||
<div className="flex w-full"> | ||
{items.length === 1 ? ( | ||
<div className="flex w-full flex-col space-y-2"> | ||
<div className="flex w-full justify-between"> | ||
<div className="flex w-full items-center space-x-2"> | ||
<div className="h-3 w-3 rounded-sm" style={{ backgroundColor: items[0]?.color }} /> | ||
<p className="text-xs capitalize">{name}</p> | ||
</div> | ||
<LegendSettings settings={settings} /> | ||
</div> | ||
{items[0]?.notes && <p className="text-xs text-gray-500">{items[0]?.notes}</p>} | ||
</div> | ||
) : ( | ||
<div className="flex w-full justify-between"> | ||
<div> | ||
}: Layer & { settings: LayerSettings }) => { | ||
const { items, notes } = legend_config as Legend; | ||
|
||
return ( | ||
<div className="flex w-full"> | ||
{items.length === 1 ? ( | ||
<div className="flex w-full flex-col space-y-2"> | ||
<div className="flex w-full justify-between"> | ||
<p className="text-xs capitalize">{name}</p> | ||
<div className="flex w-full items-center space-x-2"> | ||
<div className="h-3 w-3 rounded-sm" style={{ backgroundColor: items[0]?.color }} /> | ||
<p className="text-xs capitalize">{name}</p> | ||
</div> | ||
<LegendSettings settings={settings} /> | ||
</div> | ||
{items[0]?.notes && <p className="text-xs text-gray-500">{items[0]?.notes}</p>} | ||
</div> | ||
{items.map((item) => ( | ||
<div key={item?.color} className="flex w-full items-center space-x-2"> | ||
<div className="h-3 w-3 rounded-sm" style={{ backgroundColor: item.color }} /> | ||
<p className="text-xs capitalize">{item.value}</p> | ||
) : ( | ||
<div className="flex w-full justify-between"> | ||
<div> | ||
<div className="flex w-full justify-between"> | ||
<p className="text-xs capitalize">{name}</p> | ||
<LegendSettings settings={settings} /> | ||
</div> | ||
</div> | ||
))} | ||
{notes && <p className="text-xs text-gray-500">{notes}</p>} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
{items.map((item) => ( | ||
<div key={item?.color} className="flex w-full items-center space-x-2"> | ||
<div className="h-3 w-3 rounded-sm" style={{ backgroundColor: item.color }} /> | ||
<p className="text-xs capitalize">{item.value}</p> | ||
</div> | ||
))} | ||
{notes && <p className="text-xs text-gray-500">{notes}</p>} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BasicLegendItem; |
10 changes: 4 additions & 6 deletions
10
client/src/containers/map/legend/legend-item/choropleth.tsx
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