-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4facfc
commit 1c4eb99
Showing
7 changed files
with
87 additions
and
36 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
.../src/components/RegistrationForms/CheckboxFieldsWrapper/CheckboxFieldsWrapper.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
48 changes: 48 additions & 0 deletions
48
apps/app/src/components/RegistrationForms/CheckboxFieldsWrapper/CheckboxFieldsWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
2 changes: 2 additions & 0 deletions
2
apps/app/src/components/RegistrationForms/CheckboxFieldsWrapper/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { CheckboxFieldsWrapper } from './CheckboxFieldsWrapper'; | ||
export { CheckboxFieldsWrapper }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,5 @@ | |
width: 100%; | ||
} | ||
|
||
.checkboxFieldsWrapper{ | ||
margin-block: 16px 8px; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters