aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Settings.js
diff options
context:
space:
mode:
authorBen Woodward <ben@bdw.to>2021-08-05 12:12:17 -0700
committerGitHub <noreply@github.com>2021-08-05 12:12:17 -0700
commit093f025de3e97339750dc3df5be626a0315507dc (patch)
tree9b740790ae1f4fb6f5ad2b675c01f37acd2f0914 /src/components/Settings.js
parent5a03a61de7ac4e8f58060ae19a309dd40eea13bc (diff)
Style and code refactor (#166)
* Move all settings below card * refactor components; lifting state up * background color * Evergreen components for everything * password error * Tighten card size * Simply hide password to basic toggle, never disable * Hide password label, too * Maximize mobile portrait width * Make wifi tip smaller * Small style tweaks * Copy: update password length error text to include helpful instructions This will need a backfill for other translations * Remove unused css * Use empty string for EncryptionMode=None value * Remove light.min.css * Include logo on wificard * Cleanup after rebase * Clean-up comments on state * Padding for mobile
Diffstat (limited to 'src/components/Settings.js')
-rw-r--r--src/components/Settings.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/components/Settings.js b/src/components/Settings.js
new file mode 100644
index 0000000..1c28dab
--- /dev/null
+++ b/src/components/Settings.js
@@ -0,0 +1,77 @@
1import { Checkbox, Pane, RadioGroup, SelectField } from 'evergreen-ui';
2import { useEffect, useState } from 'react';
3import { useTranslation } from 'react-i18next';
4import i18n from '../i18n';
5import './style.css';
6
7export const Settings = (props) => {
8 const { t } = useTranslation();
9 const [encryptionModes] = useState([
10 { label: 'None', value: '' },
11 { label: 'WPA/WPA2/WPA3', value: 'WPA' },
12 { label: 'WEP', value: 'WEP' },
13 ]);
14
15 useEffect(() => {
16 if (props.firstLoad.current && window.innerWidth < 500) {
17 props.onFirstLoad();
18 props.onOrientationChange(true);
19 }
20 });
21
22 return (
23 <Pane id="settings" maxWidth={props.settings.portrait ? '350px' : '100%'}>
24 <SelectField
25 width={300}
26 inputHeight={38}
27 label={t('select')}
28 selected={i18n.language}
29 onChange={(e) => props.onLanguageChange(e.target.value)}
30 >
31 <option value="en-US">English</option>
32 <option value="ar">Arabic - العربية</option>
33 <option value="ca">Catalan - Català</option>
34 <option value="zh-HK">Chinese Hong Kong - 简体中文</option>
35 <option value="zh-CN">Chinese Simplified - 简体中文</option>
36 <option value="nl-NL">Dutch - Nederlands</option>
37 <option value="fr-FR">French - Français</option>
38 <option value="de-DE">German - Deutsch</option>
39 <option value="hi-IN">Hindi - हिन्दी</option>
40 <option value="id-ID">Indonesian</option>
41 <option value="it-IT">Italian</option>
42 <option value="ja">Japanese - 日本語</option>
43 <option value="ko">Korean - 한국어</option>
44 <option value="no-NB">Norwegian - Norsk</option>
45 <option value="oc">Occitan</option>
46 <option value="fa-IR">Persian Iran - فارسی</option>
47 <option value="pl-PL">Polish - Polski</option>
48 <option value="pt">Portuguese - Português</option>
49 <option value="pt-BR">Portuguese - Português brasileiro</option>
50 <option value="ru-RU">Russian - Русский</option>
51 <option value="es">Spanish - Español</option>
52 <option value="tr-TR">Turkish - Türkçe</option>
53 <option value="uk-UA">Ukrainian - Українська</option>
54 </SelectField>
55
56 <Checkbox
57 label={t('button.rotate')}
58 checked={props.settings.portrait}
59 onChange={() => props.onOrientationChange(!props.settings.portrait)}
60 />
61 <Checkbox
62 label={t('wifi.password.hide')}
63 checked={props.settings.hidePassword}
64 onChange={() =>
65 props.onHidePasswordChange(!props.settings.hidePassword)
66 }
67 />
68 <RadioGroup
69 label={t('wifi.password.encryption')}
70 size={16}
71 value={props.settings.encryptionMode}
72 options={encryptionModes}
73 onChange={(e) => props.onEncryptionModeChange(e.target.value)}
74 />
75 </Pane>
76 );
77};