@@ -12,24 +44,76 @@ const StepOne = ({ data, setData }) => {
Photo
-
-
Add headshot
+ {uploadedImageHex ? (
+
+ ) : (
+
+ )}
+
+ Add Photo
+
Please upload a valid image file
+ {isPopupVisible && (
+
+
+
Upload photo
+
Choose a file to upload as your profile picture.
+
+
+ Cancel
+
+
+ Choose file
+
+
+
+
+
+ )}
diff --git a/src/pages/welcome/stepThree/index.js b/src/pages/welcome/stepThree/index.js
new file mode 100644
index 00000000..8b0f84c4
--- /dev/null
+++ b/src/pages/welcome/stepThree/index.js
@@ -0,0 +1,34 @@
+import Form from '../../../components/form';
+import TextInput from '../../../components/form/textInput';
+
+const StepThree = ({ data, setData }) => {
+ return (
+ <>
+
+
Training info
+
+
+ >
+ );
+};
+
+export default StepThree;
diff --git a/src/pages/welcome/stepTwo/index.js b/src/pages/welcome/stepTwo/index.js
index f40dad3e..50b06462 100644
--- a/src/pages/welcome/stepTwo/index.js
+++ b/src/pages/welcome/stepTwo/index.js
@@ -1,14 +1,31 @@
import Form from '../../../components/form';
+import TextInput from '../../../components/form/textInput';
const StepTwo = ({ data, setData }) => {
return (
<>
-
Bio
+ Contact info
diff --git a/src/pages/welcome/style.css b/src/pages/welcome/style.css
index 7ff35605..7cf4dfc1 100644
--- a/src/pages/welcome/style.css
+++ b/src/pages/welcome/style.css
@@ -1,3 +1,10 @@
+.welcome-form {
+ height: 30vh;
+ width: 80vw;
+ overflow: auto;
+ box-sizing: border-box;
+}
+
.welcome-titleblock {
margin-bottom: 32px;
}
@@ -19,6 +26,11 @@
gap: 16px;
align-items: center;
}
+.welcome-form-profileimg-icon {
+ width: 40px;
+ height: 40px;
+ border-radius: 20px;
+}
.welcome-form-profileimg-error {
color: transparent;
}
@@ -42,3 +54,89 @@
grid-template-columns: 1fr 1fr;
gap: 24px;
}
+.welcome-form-profileimg-addimg-button {
+ background-color: #f0f5fa;
+ color: #64648c;
+ border-radius: 4px;
+ padding: 2px 4px;
+ border-width: 0;
+ transition:
+ background-color 0.3s,
+ color 0.3s;
+ white-space: nowrap;
+}
+.welcome-form-profileimg-addimg-button:hover {
+ background-color: #000046;
+ color: #ffffff;
+ border-radius: 4px;
+}
+
+.popup {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ z-index: 100;
+}
+
+.popup-content {
+ display: flex;
+ flex-direction: column;
+ gap: 2.5rem;
+ background: white;
+ padding: 20px;
+ border-radius: 8px;
+ text-align: center;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
+ height: 15rem;
+}
+
+.popup-content h3 {
+ text-align: left;
+}
+.popup-content p {
+ text-align: left;
+}
+
+.popup-options {
+ display: flex;
+ gap: 10px;
+}
+
+.popup-options button {
+ flex: 1;
+ background-color: #f0f5fa;
+ color: #64648c;
+ border-radius: 4px;
+ padding: 2px 4px;
+ border-width: 0;
+ transition:
+ background-color 0.3s,
+ color 0.3s;
+}
+.popup-options button:hover {
+ background-color: #000046;
+ color: #ffffff;
+}
+
+.custom-file-upload {
+ display: inline-block;
+ flex: 1;
+ font-size: larger;
+ padding: 14px 24px;
+ cursor: pointer;
+ background-color: #000046;
+ color: #ffffff;
+ border-radius: 4px;
+ border-width: 0;
+ transition:
+ background-color 0.3s,
+ color 0.3s;
+}
+.custom-file-upload:hover {
+ background-color: #f0f5fa;
+ color: #64648c;
+}
diff --git a/src/service/apiClient.js b/src/service/apiClient.js
index 5f3cdbcf..9664c720 100644
--- a/src/service/apiClient.js
+++ b/src/service/apiClient.js
@@ -5,12 +5,44 @@ async function login(email, password) {
}
async function register(email, password) {
- await post('users', { email, password }, false);
+ const res = await post('users', { email, password }, false);
+
+ if (res.status === 'fail') {
+ return res;
+ }
+
return await login(email, password);
}
-async function createProfile(userId, firstName, lastName, githubUrl, bio) {
- return await patch(`users/${userId}`, { firstName, lastName, githubUrl, bio });
+async function updateProfile(
+ userId,
+ firstName,
+ lastName,
+ bio,
+ username,
+ githubUsername,
+ profilePicture,
+ mobile
+) {
+ return await patch(`users/${userId}`, {
+ firstName,
+ lastName,
+ bio,
+ username,
+ githubUsername,
+ profilePicture,
+ mobile
+ });
+}
+
+async function getUserData(userId) {
+ const res = await get(`users/${userId}`);
+ return res.data.user;
+}
+
+async function getUsers() {
+ const res = await get(`users`);
+ return res.data.users;
}
async function getPosts() {
@@ -18,6 +50,11 @@ async function getPosts() {
return res.data.posts;
}
+async function getCohorts() {
+ const res = await get('cohorts');
+ return res.data.cohorts;
+}
+
async function post(endpoint, data, auth = true) {
return await request('POST', endpoint, data, auth);
}
@@ -52,4 +89,4 @@ async function request(method, endpoint, data, auth = true) {
return response.json();
}
-export { login, getPosts, register, createProfile };
+export { login, getPosts, register, updateProfile, getCohorts, getUserData, getUsers };
diff --git a/src/service/mockData.js b/src/service/mockData.js
index d49e98a4..0ef02b5c 100644
--- a/src/service/mockData.js
+++ b/src/service/mockData.js
@@ -8,7 +8,14 @@ const user = {
firstName: 'Joe',
lastName: 'Bloggs',
bio: 'Lorem ipsum dolor sit amet.',
- githubUrl: 'https://github.com/vherus'
+ githubUrl: 'https://github.com/vherus',
+ githubUsername: 'vherus',
+ specialism: 'Full Stack',
+ startDate: 'January 2020',
+ endDate: 'June 2020',
+ username: 'test-user',
+ mobile: '0123456789',
+ password: 'password'
}
};
diff --git a/src/styles/_form.css b/src/styles/_form.css
index 419cfb63..a9639892 100644
--- a/src/styles/_form.css
+++ b/src/styles/_form.css
@@ -21,6 +21,20 @@ form label {
position: relative;
}
+.input-error {
+ border: 1px solid red;
+}
+.input-error:focus {
+ border: 1px solid red;
+}
+
+.passwordreveal-error {
+ border: 1px solid red;
+}
+.passwordreveal-error:focus {
+ border: 1px solid red;
+}
+
.input-icon {
position: absolute;
left: 16px;
@@ -31,7 +45,7 @@ form label {
padding-right: 10px;
}
-.showpasswordbutton {
+.lockbutton {
position: absolute;
bottom: 28px;
right: 16px;
@@ -40,6 +54,16 @@ form label {
transform: translateY(19px);
transition: all 0.2s ease;
}
+
+.showpasswordbutton {
+ position: absolute;
+ top: 20px;
+ right: 16px;
+ z-index: 2;
+ background: none;
+ transform: translateY(19px);
+ transition: all 0.2s ease;
+}
.showpasswordbutton:hover {
opacity: 0.7;
}
@@ -47,9 +71,25 @@ form label {
opacity: 0.4;
}
+.showpasswordbutton-duo {
+ position: absolute;
+ bottom: 28px;
+ right: 50px;
+ z-index: 2;
+ background: none;
+ transform: translateY(19px);
+ transition: all 0.2s ease;
+}
+.showpasswordbutton-duo:hover {
+ opacity: 0.7;
+}
+.showpasswordbutton-duo.__faded {
+ opacity: 0.4;
+}
+
.passwordreveal {
position: absolute;
- bottom: 0;
+ /* bottom: 0; */
right: 0;
width: 100%;
z-index: 1;