aboutsummaryrefslogtreecommitdiff
path: root/modern/src/UserPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/UserPage.js')
-rw-r--r--modern/src/UserPage.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js
new file mode 100644
index 00000000..da8ba1b6
--- /dev/null
+++ b/modern/src/UserPage.js
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import TextField from '@material-ui/core/TextField';
+
+import t from './common/localization';
+import EditPage from './EditPage';
+
+const UserPage = () => {
+ const [item, setItem] = useState();
+
+ const [name, setName] = useState('');
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
+
+ const getItem = () => {
+ const updatedItem = item;
+ updatedItem.name = name;
+ updatedItem.email = email;
+ updatedItem.password = password;
+ return updatedItem;
+ };
+
+ return (
+ <EditPage endpoint="users" setItem={setItem} getItem={getItem}>
+ {item &&
+ <>
+ <TextField
+ margin="normal"
+ fullWidth
+ defaultValue={item.name}
+ onChange={(event) => setName(event.target.value)}
+ label={t('sharedName')}
+ variant="filled" />
+ <TextField
+ margin="normal"
+ fullWidth
+ defaultValue={item.email}
+ onChange={(event) => setEmail(event.target.value)}
+ label={t('userEmail')}
+ variant="filled" />
+ <TextField
+ margin="normal"
+ fullWidth
+ type="password"
+ onChange={(event) => setPassword(event.target.value)}
+ label={t('userPassword')}
+ variant="filled" />
+ </>
+ }
+ </EditPage>
+ );
+}
+
+export default UserPage;