Skip to content

Commit

Permalink
Fix colors for FormSelect, add typed props
Browse files Browse the repository at this point in the history
  • Loading branch information
katamatata committed Mar 6, 2023
1 parent 5fadd46 commit 3d4ab05
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const DeclineMentorshipButton = ({
name="ifDeclinedByMentor_chosenReasonForDecline"
label=""
items={formDeclineOptions}
{...formik}
formik={formik}
/>
{formik.values.ifDeclinedByMentor_chosenReasonForDecline ===
'other' ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const EditableEducation = ({ profile, profileSaveStart }: any) => {
name="mentee_highestEducationLevel"
placeholder="Education Level"
items={formEducationLevels}
{...formik}
formik={formik}
/>
</Editable>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const EditableLanguages = ({ profile, profileSaveStart }: any) => {
items={formLanguages}
multiselect
placeholder="Start typing and select languages"
{...formik}
formik={formik}
/>
</Editable>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const EditableMenteeCount = ({ profile, profileSaveStart }: any) => {
name="menteeCountCapacity"
placeholder="Mentee count"
items={formMenteeCountCapacityOptions}
{...formik}
formik={formik}
/>
<Checkbox.Form
name="optOutOfMenteesFromOtherRediLocation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const EditableOccupation = ({ profile, profileSaveStart }: any) => {
name="mentee_occupationCategoryId"
placeholder="Current Occupation"
items={formMenteeOccupationCategories}
{...formik}
formik={formik}
/>
{occupation === 'job' && (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import { subYears } from 'date-fns'

import {
FormDatePicker,
FormInput,
FormSelect,
} from '@talent-connect/shared-atomic-design-components'
import { Editable } from '@talent-connect/shared-atomic-design-components'
Expand Down Expand Up @@ -68,7 +66,7 @@ const EditablePersonalDetail = ({ profile, profileSaveStart }: any) => {
name="gender"
placeholder="Prefer not to answer"
items={formGenders}
{...formik}
formik={formik}
/>

<FormDatePicker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const EditableRediClass = ({ profile, profileSaveStart }: any) => {
label="Which course are you taking at ReDI?"
name="mentee_currentlyEnrolledInCourse"
items={formCourses}
{...formik}
formik={formik}
/>
</Editable>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const MSessions = ({
name="minuteDuration"
placeholder="Add the duration of the session"
items={formMentoringSessionDurationOptions}
{...formik}
formik={formik}
/>
</form>
</Modal.Body>
Expand Down
2 changes: 1 addition & 1 deletion apps/redi-connect/src/pages/front/signup/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function SignUp() {
name="mentee_currentlyEnrolledInCourse"
placeholder="Choose your ReDI Course"
items={formCourses}
{...formik}
formik={formik}
/>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function ModalForm({
label="Location (Federal State in Germany)"
items={federalStatesOptions}
placeholder="Select federal states"
{...formik}
formik={formik}
/>
<Checkbox.Form
name="isRemotePossible"
Expand Down Expand Up @@ -306,7 +306,7 @@ function ModalForm({
label="Related positions*"
name="relatesToPositions"
items={formRelatedPositions}
{...formik}
formik={formik}
multiselect
placeholder="Start typing and select positions"
closeMenuOnSelect={false}
Expand All @@ -315,7 +315,7 @@ function ModalForm({
label="Ideal technical skills*"
name="idealTechnicalSkills"
items={formTopSkills}
{...formik}
formik={formik}
multiselect
placeholder="Start typing and select skills"
closeMenuOnSelect={false}
Expand All @@ -324,7 +324,7 @@ function ModalForm({
label="Employment type*"
name="employmentType"
items={formEmploymentType}
{...formik}
formik={formik}
/>
<FormInput
name="languageRequirements"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export function JobseekerFormSectionEducation({
name={`education[${index}].certificationType`}
label="The type of certification*"
items={formCertificationTypes}
{...formik}
formik={formik}
/>
<FormInput
name={`education[${index}].institutionName`}
Expand Down Expand Up @@ -363,7 +363,7 @@ export function JobseekerFormSectionEducation({
name={`education[${index}].startDateMonth`}
label="Started in month*"
items={formMonthsOptions}
{...formik}
formik={formik}
/>
</Columns.Column>
<Columns.Column size={6}>
Expand All @@ -382,7 +382,7 @@ export function JobseekerFormSectionEducation({
name={`education[${index}].endDateMonth`}
label="Ended in month*"
items={formMonthsOptions}
{...formik}
formik={formik}
/>
</Columns.Column>
<Columns.Column size={6}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export function JobseekerFormSectionImportantDetails({
label="What kind of employment are you looking for?*"
name="desiredEmploymentType"
items={formDesiredEmploymentType}
{...formik}
formik={formik}
multiselect
placeholder="Select desired employment types"
closeMenuOnSelect={false}
Expand All @@ -319,7 +319,7 @@ export function JobseekerFormSectionImportantDetails({
label="When are you available to start?*"
name="availability"
items={formAvailabilityOptions}
{...formik}
formik={formik}
/>
{formik.values.availability === 'date' ? (
<FormDatePicker
Expand All @@ -338,7 +338,7 @@ export function JobseekerFormSectionImportantDetails({
label="What is your immigration status?"
name="immigrationStatus"
items={formImmigrationStatusOptions}
{...formik}
formik={formik}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ export function JobseekerFormSectionLanguages({
name={`workingLanguages[${index}].language`}
label="Language*"
items={formLanguages}
{...formik}
formik={formik}
/>
<FormSelect
name={`workingLanguages[${index}].proficiencyLevelId`}
label="Level of proficiency*"
items={formLanguageProficiencyLevels}
{...formik}
formik={formik}
/>
</FormDraggableAccordion>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function ModalForm({
name="federalState"
label="Your place of residence (state)*"
items={federalStatesOptions}
{...formik}
formik={formik}
/>
<Checkbox.Form
name={`willingToRelocate`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function JobseekerFormSectionOverview({
label="Desired position* (pick 1-3)"
name="desiredPositions"
items={formDesiredPositions}
{...formik}
formik={formik}
multiselect
placeholder="Start typing and select positions"
closeMenuOnSelect={false}
Expand All @@ -171,7 +171,7 @@ export function JobseekerFormSectionOverview({
label="Current ReDI course"
name="currentlyEnrolledInCourse"
items={formCourses}
{...formik}
formik={formik}
/>
)}
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export function JobseekerFormSectionProfessionalExperience({
name={`experience[${index}].startDateMonth`}
label="Started in month*"
items={formMonthsOptions}
{...formik}
formik={formik}
/>
</Columns.Column>
<Columns.Column size={6}>
Expand All @@ -375,7 +375,7 @@ export function JobseekerFormSectionProfessionalExperience({
name={`experience[${index}].endDateMonth`}
label="Ended in month*"
items={formMonthsOptions}
{...formik}
formik={formik}
/>
</Columns.Column>
<Columns.Column size={6}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function JobseekerFormSectionSummary({
label="Your top technical skills (pick 1-5 skills)"
name="topSkills"
items={formTopSkills}
{...formik}
formik={formik}
multiselect
placeholder="Start typing and select skills"
closeMenuOnSelect={false}
Expand Down
6 changes: 3 additions & 3 deletions apps/redi-talent-pool/src/pages/front/signup/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export default function SignUp() {
name="rediLocation"
placeholder="Choose your ReDI Location"
items={formRediLocations}
{...formik}
formik={formik}
/>
)}

Expand All @@ -297,7 +297,7 @@ export default function SignUp() {
items={formCourses.filter(
(course) => course.location === formik.values.rediLocation
)}
{...formik}
formik={formik}
/>
)}

Expand Down Expand Up @@ -326,7 +326,7 @@ export default function SignUp() {
name="howDidHearAboutRediKey"
placeholder="How did you first hear about ReDI Talent Pool?"
items={howDidHearAboutRediOptionsEntries}
{...formik}
formik={formik}
/>
{formik.values.howDidHearAboutRediKey === 'other' ? (
<FormInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export const formSelectStyles = {
}),
control: (provided: any, state: any) => ({
...provided,
borderColor: state.isFocused ? '#ea5b29' : '#a0a0a0',
borderColor: state.isFocused ? 'black' : '#A0A0A0',
minHeight: '48px',
boxShadow: 'inset 0 2px 6px rgba(178, 180, 181, 0.3)',
'&:hover': {
borderColor: state.isFocused ? '#ea5b29' : '#f6b9a2',
borderColor: 'black'
},
}),
multiValue: (provided: any) => ({
Expand Down
30 changes: 20 additions & 10 deletions libs/shared-atomic-design-components/src/lib/atoms/FormSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import Select, { components } from 'react-select'
import { Form } from 'react-bulma-components'
import { Icon } from '../atoms'
import { get } from 'lodash'
import { useFormik } from 'formik'
import { formSelectStyles } from './FormSelect.styles'

export const DropdownIndicator = (props: any) => (
Expand All @@ -23,24 +23,34 @@ const MultiValueRemove = (props: any) => (
</components.MultiValueRemove>
)

// TODO add typed safe props
function FormSelect(props: any) {
interface FormSelectOption {
value: string | number
label: string
}

interface FormSelectProps {
name: string
items?: FormSelectOption[]
placeholder?: string
label?: string
customOnChange?: () => void,
multiselect?: boolean,
disabled?: boolean,
closeMenuOnSelect?: boolean,
formik: ReturnType<typeof useFormik>
}

function FormSelect(props: FormSelectProps) {
const {
name,
items,
placeholder,
label,
customOnChange,
values,
setFieldTouched,
handleBlur,
multiselect,
isSubmitting,
setFieldValue,
touched,
errors,
disabled,
closeMenuOnSelect,
formik: { values, setFieldTouched, setFieldValue, touched, errors, handleBlur, isSubmitting }
} = props

const handleOnChangeDefault = (option: any = []) => {
Expand Down

0 comments on commit 3d4ab05

Please sign in to comment.