Skip to content

Commit

Permalink
chore: add implementation example of emoji picker
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszRostkowski committed Jan 24, 2025
1 parent a084be8 commit 5d292a9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hooks/forms/useTestForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const defaultValues: TestFormValues = {
age: '',
education: '',
interests: [],
icon: '',
}

export const useTestForm = () => {
Expand Down Expand Up @@ -52,6 +53,7 @@ export const useTestForm = () => {
music: { required: t('test_form.errors.music') },
interests: { required: t('test_form.errors.interests') },
sex: { required: t('test_form.errors.sex') },
icon: { required: t('test_form.errors.icon') },
}

const {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
"education": "Education is required",
"email": "Email is required",
"interests": "At least 1 interest is needed",
"icon": "Icon is required",
"music": "At least 1 music is needed",
"name": "Name is required",
"phone_format": "Phone number must be in form 000-000-000",
Expand All @@ -308,6 +309,7 @@
"female": "Female",
"games": "Games",
"interests": "Interests",
"icon": "Icon",
"male": "Male",
"middle": "Middle",
"name_placeholder": "Name",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
"education": "Wykształcenie jest wymagane",
"email": "Email jest wymagany",
"interests": "Zaznacz przynajmniej 1 zainteresowanie",
"icon": "Ikona jest wymagana",
"music": "Zaznacz przynajmniej 1 rodzaj muzyki",
"name": "Imie jest wymagane",
"phone_format": "Numer telefonu musi być w formacie 000-000-000",
Expand All @@ -307,6 +308,7 @@
"female": "Kobieta",
"games": "Gry",
"interests": "Zainteresowania",
"icon": "Ikona",
"male": "Mezczyzna",
"middle": "Gimnazjalne",
"name_placeholder": "Imie",
Expand Down
8 changes: 8 additions & 0 deletions src/screens/TestFormScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ export const TestFormScreen = (): JSX.Element => {
name="music"
rules={VALIDATION.music}
/>
<ControlledField.EmojiPicker
{...{ control, errors }}
isRequired
label={t('test_form.icon')}
placeholder={t('test_form.icon')}
name="icon"
rules={VALIDATION.icon}
/>
<ControlledField.CheckboxGroup
{...{ control, errors }}
items={interests}
Expand Down
1 change: 1 addition & 0 deletions src/types/testForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export type TestFormValues = {
age: string
education: string
interests: string[]
icon: string
}

0 comments on commit 5d292a9

Please sign in to comment.