simplify code

This commit is contained in:
Mateusz Konieczny 2022-12-06 19:12:37 +01:00
parent 57361dcbdc
commit 21eea660be
5 changed files with 9 additions and 27 deletions

View File

@ -3,10 +3,7 @@ import React from 'react';
import './creative-switcher.css';
import { useDisplayPreferences } from '../displayPreferences-context';
interface CreativeSwitcherProps {
}
const CreativeSwitcherProps: React.FC<CreativeSwitcherProps> = (props) => {
export const CreativeSwitcher: React.FC<{}> = () => {
const { creative, creativeSwitch } = useDisplayPreferences();
return (
<form className={`creative-switcher ${creative}`} onSubmit={creativeSwitch}>
@ -17,4 +14,3 @@ const CreativeSwitcherProps: React.FC<CreativeSwitcherProps> = (props) => {
</form>
);
}
export default CreativeSwitcherProps;

View File

@ -3,10 +3,7 @@ import React from 'react';
import './flood-switcher.css';
import { useDisplayPreferences } from '../displayPreferences-context';
interface FloodSwitcherProps {
}
const FloodSwitcherProps: React.FC<FloodSwitcherProps> = (props) => {
export const FloodSwitcher: React.FC<{}> = () => {
const { flood, floodSwitch } = useDisplayPreferences();
return (
<form className={`flood-switcher ${flood}`} onSubmit={floodSwitch}>
@ -17,4 +14,3 @@ const FloodSwitcherProps: React.FC<FloodSwitcherProps> = (props) => {
</form>
);
}
export default FloodSwitcherProps;

View File

@ -3,10 +3,7 @@ import React from 'react';
import './housing-switcher.css';
import { useDisplayPreferences } from '../displayPreferences-context';
interface HousingSwitcherProps {
}
const HousingSwitcherProps: React.FC<HousingSwitcherProps> = (props) => {
export const HousingSwitcher: React.FC<{}> = () => {
const { housing, housingSwitch } = useDisplayPreferences();
return (
<form className={`housing-switcher ${housing}`} onSubmit={housingSwitch}>
@ -17,5 +14,3 @@ const HousingSwitcherProps: React.FC<HousingSwitcherProps> = (props) => {
</form>
);
}
export default HousingSwitcherProps;

View File

@ -33,12 +33,12 @@ import ThemeSwitcher from './theme-switcher';
import DataLayerSwitcher from './data-switcher';
import BoroughSwitcher from './borough-switcher';
import ParcelSwitcher from './parcel-switcher';
import FloodSwitcher from './flood-switcher';
import { FloodSwitcher } from './flood-switcher';
import ConservationAreaSwitcher from './conservation-switcher';
import HistoricDataSwitcher from './historic-data-switcher';
import VistaSwitcher from './vista-switcher';
import CreativeSwitcher from './creative-switcher';
import HousingSwitcher from './housing-switcher';
import { VistaSwitcher } from './vista-switcher';
import { CreativeSwitcher } from './creative-switcher';
import { HousingSwitcher } from './housing-switcher';
import { BuildingMapTileset } from '../config/tileserver-config';
interface ColouringMapProps {

View File

@ -3,10 +3,7 @@ import React from 'react';
import './vista-switcher.css';
import { useDisplayPreferences } from '../displayPreferences-context';
interface VistaSwitcherProps {
}
const VistaSwitcherProps: React.FC<VistaSwitcherProps> = (props) => {
export const VistaSwitcher: React.FC<{}> = () => {
const { vista, vistaSwitch } = useDisplayPreferences();
return (
<form className={`vista-switcher ${vista}`} onSubmit={vistaSwitch}>
@ -16,6 +13,4 @@ const VistaSwitcherProps: React.FC<VistaSwitcherProps> = (props) => {
</button>
</form>
);
}
export default VistaSwitcherProps; // TODO remove
}