Skip to content

Commit

Permalink
added location type, added temperature state. fixed on change type
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomcv committed Jul 19, 2020
1 parent 3131aaf commit 8b1ad40
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/MainContent/MainContent.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import React, { FunctionComponent, useState } from 'react';
import LocationSelector from '../LocationSelector';
import { TemperatureUnit, Location } from '../../sharedTypes';
import './MainContent.scss';

const MainContent: FunctionComponent = () => {
const [location, setLocation] = useState<string>('lisbon');
const [location, setLocation] = useState<Location>('lisbon');
const [temperatureUnit, setTemperatureUnit] = useState<TemperatureUnit>('celsius');

return (
<main className="main-content">
<LocationSelector
onChange={(e) => setLocation(e.target.value)}
value={location}
onChange={(event) => {
const value = event.target.value as Location;
setLocation(value);
}}
/>
</main>
);
Expand Down

0 comments on commit 8b1ad40

Please sign in to comment.