MapPage - refactor

This commit is contained in:
Dawid Wysokiński 2020-12-24 17:48:06 +01:00
parent 6885b2c1ba
commit 610d66fce1
4 changed files with 48 additions and 69 deletions

View File

@ -255,56 +255,47 @@ function MapPage() {
variant="standard"
type="color"
/>
<FormControlLabel
label={t('inputLabels.markersOnly')}
control={
<Checkbox
name="markersOnly"
checked={settings.markersOnly}
onChange={handleSettingsChange}
{[
{
name: 'markersOnly',
checked: settings.markersOnly,
onChange: handleSettingsChange,
},
{
name: 'showBarbarian',
checked: settings.showBarbarian,
onChange: handleSettingsChange,
},
{
name: 'largerMarkers',
checked: settings.largerMarkers,
onChange: handleSettingsChange,
},
{
name: 'showGrid',
checked: settings.showGrid,
onChange: handleSettingsChange,
},
{
name: 'showContinentNumbers',
checked: settings.showContinentNumbers,
onChange: handleSettingsChange,
},
].map(({ name, checked, onChange }) => {
return (
<FormControlLabel
key={name}
label={t('inputLabels.' + name)}
control={
<Checkbox
name={name}
checked={checked}
onChange={onChange}
/>
}
/>
}
/>
<FormControlLabel
label={t('inputLabels.showBarbarianVillages')}
control={
<Checkbox
name="showBarbarian"
checked={settings.showBarbarian}
onChange={handleSettingsChange}
/>
}
/>
<FormControlLabel
label={t('inputLabels.largerMarkers')}
control={
<Checkbox
name="largerMarkers"
checked={settings.largerMarkers}
onChange={handleSettingsChange}
/>
}
/>
<FormControlLabel
label={t('inputLabels.continentGrid')}
control={
<Checkbox
name="showGrid"
checked={settings.showGrid}
onChange={handleSettingsChange}
/>
}
/>
<FormControlLabel
label={t('inputLabels.continentNumbers')}
control={
<Checkbox
name="showContinentNumbers"
checked={settings.showContinentNumbers}
onChange={handleSettingsChange}
/>
}
/>
);
})}
</div>
</Card>
<Card>

View File

@ -27,22 +27,10 @@ function Map({
return (
<div className={classes.container}>
{loading ? (
{loading && (
<Alert variant="filled" severity="warning">
{loadingInfo}
</Alert>
) : (
<Alert variant="filled" severity="info">
URL:{' '}
<Link
color="inherit"
underline="always"
className={classes.link}
href={src}
>
{src}
</Link>
</Alert>
)}
<div
className={classes.imageWrapper}
@ -85,7 +73,7 @@ const useStyles = makeStyles(theme => {
marginTop: theme.spacing(2),
},
imageWrapper: {
marginTop: theme.spacing(1),
marginTop: theme.spacing(2),
margin: 'auto',
},
};

View File

@ -13,10 +13,10 @@ const translations = {
gridLineColor: 'Grid line color',
continentNumberColor: 'Continent number color',
markersOnly: 'Markers only',
showBarbarianVillages: 'Show barbarian villages',
showBarbarian: 'Show barbarian villages',
largerMarkers: 'Larger markers',
continentGrid: 'Continent grid',
continentNumbers: 'Continent numbers',
showGrid: 'Continent grid',
showContinentNumbers: 'Continent numbers',
},
buttons: {
addMarker: 'Add marker',

View File

@ -13,10 +13,10 @@ const translations = {
gridLineColor: 'Kolor linii',
continentNumberColor: 'Kolor numeru kontynentu',
markersOnly: 'Tylko oznaczenia',
showBarbarianVillages: 'Pokaż opuszczone',
showBarbarian: 'Pokaż opuszczone',
largerMarkers: 'Większe znaczniki',
continentGrid: 'Granice kontynentów',
continentNumbers: 'Numery kontynentów',
showGrid: 'Granice kontynentów',
showContinentNumbers: 'Numery kontynentów',
},
buttons: {
addMarker: 'Dodaj marker',