Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sime jadrijev/476 register page #482

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
50e501c
slice ProgressBarTab
SimeJadrijev Jan 20, 2025
d221885
slice ProgressBar
SimeJadrijev Jan 20, 2025
38ded97
allow navigating forward and backwards on navigation bar
SimeJadrijev Jan 23, 2025
2a4eabf
add input fields for first step registration form
SimeJadrijev Jan 23, 2025
5808997
fix progressbar key prop
SimeJadrijev Jan 23, 2025
c42221f
implement checkbox fields
SimeJadrijev Jan 23, 2025
a7365e0
implement dynamic form loading and General Registration Form layout
SimeJadrijev Jan 23, 2025
5699ce1
add line breaks to css
SimeJadrijev Jan 23, 2025
1207c51
implement authfooter component
SimeJadrijev Jan 24, 2025
a434081
implement the majority of 2nd registration form
SimeJadrijev Jan 28, 2025
2240d73
refactor buttons to general component
SimeJadrijev Jan 28, 2025
841aa58
fix dropdown menus default state
SimeJadrijev Jan 28, 2025
324081e
fix data collecting in second form
SimeJadrijev Jan 28, 2025
77ad26f
refactor forms to have the main state in general component
SimeJadrijev Jan 28, 2025
f36105e
implement utility functions for input validation
SimeJadrijev Jan 29, 2025
c933aa1
implement validation logic for first step of registration form
SimeJadrijev Jan 29, 2025
66ab186
improve phone number validation
SimeJadrijev Jan 29, 2025
95a7a05
utilize validation for 2nd step of registration form
SimeJadrijev Jan 29, 2025
4ee1ea7
introduce enum for user data fields and utilize it
SimeJadrijev Jan 29, 2025
05d94fb
fix handleStepClick
SimeJadrijev Jan 30, 2025
e6d5170
implement registration provider
SimeJadrijev Jan 31, 2025
2b9cdae
utilize error handling from registration provider
SimeJadrijev Jan 31, 2025
5cf68fc
implement switching form steps on register button click
SimeJadrijev Jan 31, 2025
3227939
fix edge cases in step switching, delete prints
SimeJadrijev Jan 31, 2025
a4facfc
fix build
SimeJadrijev Jan 31, 2025
1c4eb99
extract CheckboxFieldsWrapper
SimeJadrijev Jan 31, 2025
65c256d
rename 2nd step file name
SimeJadrijev Feb 2, 2025
1a75df7
fix
SimeJadrijev Feb 2, 2025
cb02ba1
slice design for 4th step form
SimeJadrijev Feb 2, 2025
c793bc6
implement adding and removing interests
SimeJadrijev Feb 2, 2025
a345cf1
fix switching through steps for 3rd and 4th steps
SimeJadrijev Feb 2, 2025
8a78844
utilize RegistrationStep enum
SimeJadrijev Feb 2, 2025
9df8ea5
display appropriate buttons depending on current step
SimeJadrijev Feb 2, 2025
f71762e
change header text depending on current step
SimeJadrijev Feb 2, 2025
b5cb25a
fix copy for error messages
SimeJadrijev Feb 4, 2025
c26f568
add page look behind the main component
SimeJadrijev Feb 4, 2025
24051d7
Merge branch 'main' of github.com:dump-hr/ddays-app into SimeJadrijev…
SimeJadrijev Feb 4, 2025
768723e
slice confirm email page and slavica header
SimeJadrijev Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/app/src/assets/icons/black-remove-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/app/src/assets/icons/check-mark-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/app/src/assets/icons/google-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/app/src/assets/icons/remove-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions apps/app/src/components/AuthFooter/AuthFooter.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.authFooter{
display: flex;
justify-content: space-between;
font-family: Inter;
color: $primary-black;
margin-top: -16px ;

span:first-child{
opacity: 0.6;
}
span:last-child{
font-weight: 600;
}
}
17 changes: 17 additions & 0 deletions apps/app/src/components/AuthFooter/AuthFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import c from './AuthFooter.module.scss';

export const AuthFooter = ({
leftMessage,
rightMessage,
}: {
leftMessage: string;
rightMessage: string;
}) => {
return (
<div className={c.authFooter}>
{/* TODO dodat da dodat da te rerouta na drugi page */}
<span>{leftMessage}</span>
<span>{rightMessage}</span>
</div>
);
};
2 changes: 2 additions & 0 deletions apps/app/src/components/AuthFooter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { AuthFooter } from './AuthFooter';
export { AuthFooter };
56 changes: 56 additions & 0 deletions apps/app/src/components/Checkbox/Checkbox.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.checkbox {
display: flex;
align-items: flex-start;

gap: 16px;
width: 100%;

input[type='checkbox'] {
appearance: none;

display: flex;
justify-content: center;
align-items: center;

min-width: 20px;
min-height: 20px;

border-radius: 4px;
border: none;
background: $black-10;

cursor: pointer;

&:checked {
background: $primary-muted-orange;

&:after {
content: "";
background: url(./../../assets/icons/check-mark-icon.svg);

position: absolute;
width: 9.583px;
height: 9.583px;
background-size: contain;
}
}



}

label {
position: relative;
top: 3px;

font-family: Inter;
letter-spacing: -0.16px;

color: $primary-black;
}
}





24 changes: 24 additions & 0 deletions apps/app/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import c from './Checkbox.module.scss';

type CheckboxProps = {
name: string;
checked: boolean;
label: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
error?: string;
} & Omit<React.HTMLProps<HTMLInputElement>, 'onChange'>;
export const Checkbox = ({ name, checked, label, onChange }: CheckboxProps) => {
return (
<>
<div className={c.checkbox}>
<input
type='checkbox'
checked={checked}
name={name}
onChange={onChange}
/>
<label>{label}</label>
</div>
</>
);
};
2 changes: 2 additions & 0 deletions apps/app/src/components/Checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Checkbox } from './Checkbox';
export { Checkbox };
1 change: 0 additions & 1 deletion apps/app/src/components/Input/Input.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
.inputWrapper {
position: relative;
width: 100%;
background-color: aqua;
}

.input {
Expand Down
18 changes: 18 additions & 0 deletions apps/app/src/components/ProgressBar/ProgressBar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.progressBar{
background-color: $black-5;
// width: 100%;
width: 350px;
height: 62px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: space-evenly;
padding: 16px;
}

.dots{
@include dottedBreak($primary-black);

display: flex;
margin-inline: 8px;
}
42 changes: 42 additions & 0 deletions apps/app/src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useRegistration } from '../../providers/RegistrationContext';
import c from './ProgressBar.module.scss';
import { ProgressBarTab } from './ProgressBarTab';
import React from 'react';

type ProgressBarProps = {
currentStep: number;
setCurrentStep: (step: number) => void;
};

export const ProgressBar = ({
currentStep,
setCurrentStep,
}: ProgressBarProps) => {
const { isStepValid } = useRegistration();

const handleStepClick = (clickedStep: number) => {
const isGoingBackwards = clickedStep <= currentStep;
const isGoingForward = clickedStep === currentStep + 1;

if (isGoingBackwards) {
setCurrentStep(clickedStep);
} else if (isGoingForward && isStepValid(currentStep)) {
setCurrentStep(clickedStep);
}
};
return (
<div className={c.progressBar}>
{[1, 2, 3, 4].map((step) => (
<React.Fragment key={step}>
<ProgressBarTab
key={step}
stepIndex={step}
active={step <= currentStep}
onClick={handleStepClick}
/>
{step < 4 && <div className={c.dots}></div>}
</React.Fragment>
))}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.progressBarTab {
display: flex;
justify-content: center;
align-items: center;

min-width: 30px;
min-height: 30px;

font-family: Inter;
font-size: 16px;
font-weight: 600;

background-color: $black-10;
color: $primary-black;

border-radius: 6px;
cursor: pointer;
}

.activeProgressBarTab {
background-color: $primary-muted-orange;
color: $primary-white;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import c from './ProgressBarTab.module.scss';

export const ProgressBarTab = ({
stepIndex,
active,
onClick,
}: {
stepIndex: number;
active: boolean;
onClick: (stepIndex: number) => void;
}) => {
return (
<div
className={`${c.progressBarTab} ${active ? c.activeProgressBarTab : ''}`}
onClick={() => onClick(stepIndex)}>
{stepIndex}
</div>
);
};
2 changes: 2 additions & 0 deletions apps/app/src/components/ProgressBar/ProgressBarTab/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { ProgressBarTab } from './ProgressBarTab';
export { ProgressBarTab };
2 changes: 2 additions & 0 deletions apps/app/src/components/ProgressBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { ProgressBar } from './ProgressBar';
export { ProgressBar };
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.checkboxFieldsWrapper{
margin-block: 16px 8px;
}

.errorMessage {
font-family: Inter;
color: red;
display: flex;
justify-content: center;
margin-top: 20px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { ChangeEvent } from 'react';
import c from './CheckboxFieldsWrapper.module.scss';
import { Checkbox } from '../../Checkbox';
import { UserDataFields } from '../../../types/user/user.dto';

type UserData = {
newsletterEnabled: boolean;
companiesNewsEnabled: boolean;
termsAndConditionsEnabled: boolean;
};
type Props = {
userData: UserData;
updateUserData: (newData: Partial<UserData>) => void;
};
export const CheckboxFieldsWrapper = ({ userData, updateUserData }: Props) => {
const handleCheckboxChange = (e: ChangeEvent<HTMLInputElement>) => {
const { name, checked } = e.target;
updateUserData({ [name]: checked });
};

return (
<div className={c.checkboxFieldsWrapper}>
<Checkbox
label='Želim primati novosti o DUMP Days konferenciji.'
checked={userData.newsletterEnabled}
name={UserDataFields.NewsletterEnabled}
onChange={handleCheckboxChange}
key={1}
/>
<Checkbox
label='Želim primati novosti o tvrtkama i otvorenim radnim pozicijama.'
checked={userData.companiesNewsEnabled}
name={UserDataFields.CompaniesNewsEnabled}
onChange={handleCheckboxChange}
key={2}
/>
<Checkbox
label='Slažem se s uvjetima i odredbama.'
checked={userData.termsAndConditionsEnabled}
name={UserDataFields.TermsAndConditionsEnabled}
onChange={handleCheckboxChange}
key={3}
/>

<p className={c.errorMessage}></p>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { CheckboxFieldsWrapper } from './CheckboxFieldsWrapper';
export { CheckboxFieldsWrapper };
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.confirmEmail {
display: flex;
flex-direction: column;
width: 422px;

.confirmEmailUpper {

margin-bottom: 48px;

h2{
color: $primary-black;
text-align: center;
font-family: NeueMachina;
font-size: 30px;
font-weight: 500;
line-height: 30px;
margin-top: 40px;
margin-bottom: 18px;
}

p{
color: $primary-black;
text-align: center;
font-family: Inter;
line-height: 22px; /* 137.5% */
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Button from '../../Button/Button';
import c from './ConfirmEmail.module.scss';

export const ConfirmEmail = () => {
return (
<div className={c.confirmEmail}>
<div className={c.confirmEmailUpper}>
<h2>Potvrdi svoj e-mail</h2>
<p>
Poslali smo ti e-mail na [email protected] da potvrdimo ispravnost
unesene adrese. Nakon što se e-mail pojavi u tvom sandučiću, klikni na
link kako bi registracija bila uspješna.
</p>
</div>

<Button children='Potvrdi email' variant='orange' />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { ConfirmEmail } from './ConfirmEmail';
export { ConfirmEmail };
Loading