+
Drop files here ...
- or
+ or
upload
diff --git a/web/src/components/ProfileTextInput/ProfileTextInput.js b/web/src/components/ProfileTextInput/ProfileTextInput.js
new file mode 100644
index 0000000..d0b07d5
--- /dev/null
+++ b/web/src/components/ProfileTextInput/ProfileTextInput.js
@@ -0,0 +1,29 @@
+import {Fragment, useState} from 'react'
+
+const ProfileTextInput = ({fields, isEditable, onChange= () => {}}) => {
+ const keyValueDisplay = Object.entries(fields)
+ return (
+
+
+ {keyValueDisplay.map(([property, value]) => (
+ {property}:
+ {
+ isEditable ?
+
+
+
onChange({...fields, [property]: target.value})}
+ value={value}
+ type="text"
+ />
+
:
+ {value}
+ }
+ ))}
+
+
+ )
+}
+
+export default ProfileTextInput
diff --git a/web/src/components/ProfileTextInput/ProfileTextInput.stories.js b/web/src/components/ProfileTextInput/ProfileTextInput.stories.js
new file mode 100644
index 0000000..daef953
--- /dev/null
+++ b/web/src/components/ProfileTextInput/ProfileTextInput.stories.js
@@ -0,0 +1,7 @@
+import ProfileTextInput from './ProfileTextInput'
+
+export const generated = () => {
+ return
+}
+
+export default { title: 'Components/ProfileTextInput' }
diff --git a/web/src/components/ProfileTextInput/ProfileTextInput.test.js b/web/src/components/ProfileTextInput/ProfileTextInput.test.js
new file mode 100644
index 0000000..e5f6e14
--- /dev/null
+++ b/web/src/components/ProfileTextInput/ProfileTextInput.test.js
@@ -0,0 +1,11 @@
+import { render } from '@redwoodjs/testing'
+
+import ProfileTextInput from './ProfileTextInput'
+
+describe('ProfileTextInput', () => {
+ it('renders successfully', () => {
+ expect(() => {
+ render(
)
+ }).not.toThrow()
+ })
+})
diff --git a/web/src/components/User2Cell/User2Cell.js b/web/src/components/User2Cell/User2Cell.js
index 791cbb7..faea1cd 100644
--- a/web/src/components/User2Cell/User2Cell.js
+++ b/web/src/components/User2Cell/User2Cell.js
@@ -1,8 +1,4 @@
-import User from 'src/components/User'
-import {Fragment} from 'react'
-import ImageUploader from 'src/components/ImageUploader'
-import Button from 'src/components/Button'
-import Editor from "rich-markdown-editor";
+import UserProfile from 'src/components/UserProfile'
export const QUERY = gql`
query FIND_USER_BY_ID($userName: String!) {
@@ -22,40 +18,6 @@ export const Loading = () =>
Loading...
export const Empty = () =>
User not found
-export const Success = ({ user }) => {
- const {userName, email} = user
- const keyValueDisplay = Object.entries({userName, name: email}) // TODO add name field to user
- return (
- <>
-
-
-
-
-
-
-
- {keyValueDisplay.map(([property, value]) => (
- {property}:
- {value}
- ))}
-
-
Edit Profile
-
-
-
-
- >
- )
+export const Success = ({user}) => {
+ return
}
diff --git a/web/src/components/UserProfile/UserProfile.js b/web/src/components/UserProfile/UserProfile.js
new file mode 100644
index 0000000..62bf827
--- /dev/null
+++ b/web/src/components/UserProfile/UserProfile.js
@@ -0,0 +1,46 @@
+import {Fragment} from 'react'
+import ImageUploader from 'src/components/ImageUploader'
+import Button from 'src/components/Button'
+import Editor from "rich-markdown-editor";
+import ProfileTextInput from 'src/components/ProfileTextInput'
+
+
+const UserProfile = ({user, isEditable}) => {
+ console.log(isEditable)
+ const {userName, email} = user
+ const editableTextFields = {userName, name: email} // TODO add name field to user
+ return (
+ <>
+
+
+
+
+
+
+
+ {isEditable ?
+ Save Profile : // TODO replace pencil with a save icon
+ Edit Profile
+ }
+
+
+
+
+ >
+ )
+}
+
+export default UserProfile
diff --git a/web/src/components/UserProfile/UserProfile.stories.js b/web/src/components/UserProfile/UserProfile.stories.js
new file mode 100644
index 0000000..f53091f
--- /dev/null
+++ b/web/src/components/UserProfile/UserProfile.stories.js
@@ -0,0 +1,7 @@
+import UserProfile from './UserProfile'
+
+export const generated = () => {
+ return
+}
+
+export default { title: 'Components/UserProfile' }
diff --git a/web/src/components/UserProfile/UserProfile.test.js b/web/src/components/UserProfile/UserProfile.test.js
new file mode 100644
index 0000000..d4ffd8d
--- /dev/null
+++ b/web/src/components/UserProfile/UserProfile.test.js
@@ -0,0 +1,11 @@
+import { render } from '@redwoodjs/testing'
+
+import UserProfile from './UserProfile'
+
+describe('UserProfile', () => {
+ it('renders successfully', () => {
+ expect(() => {
+ render(
)
+ }).not.toThrow()
+ })
+})
diff --git a/web/src/index.css b/web/src/index.css
index 5b01aec..46d152f 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -36,7 +36,7 @@
body {
/* TODO can I use a tailwind class here? */
- background-color: #E5E5E5;
+ background-color: #f7fafc;
}
button, input, label, textarea {
diff --git a/web/src/pages/EditUser2Page/EditUser2Page.js b/web/src/pages/EditUser2Page/EditUser2Page.js
new file mode 100644
index 0000000..767effa
--- /dev/null
+++ b/web/src/pages/EditUser2Page/EditUser2Page.js
@@ -0,0 +1,12 @@
+import MainLayout from 'src/layouts/MainLayout'
+import EditUser2Cell from 'src/components/EditUser2Cell'
+
+const UserPage = ({ userName }) => {
+ return (
+
+
+
+ )
+}
+
+export default UserPage
diff --git a/web/src/pages/UserPage2/UserPage2.js b/web/src/pages/User2Page/User2Page.js
similarity index 100%
rename from web/src/pages/UserPage2/UserPage2.js
rename to web/src/pages/User2Page/User2Page.js