refactor(tabs): Functional component conversion

This commit is contained in:
alexsparkes
2024-05-29 17:19:25 +01:00
parent e7482e8fe6
commit e5ef40b04b
3 changed files with 95 additions and 100 deletions

View File

@@ -1,20 +1,11 @@
import { useState, useEffect, useCallback } from 'react';
import { useCallback } from 'react';
import { MdAutoAwesome } from 'react-icons/md';
import { Header, Row, Content, Action, PreferencesWrapper } from 'components/Layout/Settings';
import { useLocalStorageState } from 'utils/useLocalStorageState';
import { Radio, Dropdown, Checkbox } from 'components/Form/Settings';
import { TextField } from '@mui/material';
import variables from 'config/variables';
const useLocalStorageState = (key, initialValue) => {
const [state, setState] = useState(() => localStorage.getItem(key) || initialValue);
useEffect(() => {
localStorage.setItem(key, state);
}, [key, state]);
return [state, setState];
};
const useWeatherSettings = () => {
const [location, setLocation] = useLocalStorageState('location', '');
const [windSpeed, setWindSpeed] = useLocalStorageState('windspeed', 'true');