Files
grungnet/src/components/map/MapTile.js

45 lines
854 B
JavaScript
Raw Normal View History

2020-09-30 13:58:43 +10:00
import React from "react";
import Tile from "../Tile";
import useDataSource from "../../helpers/useDataSource";
import { mapSources as defaultMapSources, unknownSource } from "../../maps";
function MapTile({
map,
isSelected,
onMapSelect,
onMapEdit,
onDone,
large,
canEdit,
badges,
}) {
const isDefault = map.type === "default";
const mapSource = useDataSource(
isDefault
? map
: map.resolutions && map.resolutions.low
? map.resolutions.low
: map,
defaultMapSources,
unknownSource
);
return (
<Tile
src={mapSource}
title={map.name}
isSelected={isSelected}
onSelect={() => onMapSelect(map)}
onEdit={() => onMapEdit(map.id)}
onDoubleClick={onDone}
large={large}
canEdit={canEdit}
badges={badges}
/>
);
}
export default MapTile;