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

Add employer page #56

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add employer page #56

wants to merge 14 commits into from

Conversation

abroddrick
Copy link
Contributor

@abroddrick abroddrick commented Apr 18, 2023

##Resolves #13

Changes proposed in this pull request:

Add employer page with the following:
Full-time vs part time
Address
Phone number
Alternate phone number
Self employment status
Ownership status
Separation reason/change in employment
Start and end dates

src/i18n/i18n.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is the "old" (storybook changes their syntax every year it seems 🙄) storybook format, let's update to the new format/syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonlenz Which format/syntax are you referring to? I originally changed it to match ssn and the other existing stories but since it expects a form to already exists it throws an error. The examples I see on the storybook site don't use a form provider, so I updated it from the old version with this versions equivalents, StoryFn instead of story etc; which I also got from online examples where people were using storybook with a react-hook-form subcomponent. The storyFn is needed because to simulate it as part of a form and those hook calls to make a temporary form need to happen in a function. Open to hear what else your suggesting or if you have a better way to set it as a form as I tried to not spend too long on it so could have easily overlooked something.


export const yupAddress = () =>
object().shape({
address: string()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a single address format, let's give standard 2 address lines.

You can also remove all the min/max length requirements on these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I was always taught any text input should have a max, even if its large. I'm down to get rid of any mins, but should we at least have a max of 255 if we want it to be an extreme max?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure let's go with 255 for now!

@abroddrick abroddrick marked this pull request as ready for review April 19, 2023 21:55
@abroddrick abroddrick requested a review from brandonlenz April 21, 2023 16:48
Copy link
Contributor

@brandonlenz brandonlenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things. Nice work!

Comment on lines +1 to +16
.city {
width: 10rem !important;
margin-right: 2rem !important;
}

.city_error {
padding-right: 2rem;
}

.state {
width: 8rem !important;
}

.zipcode {
width: 8rem !important;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the !importants really needed? Its usually code smell, so definitely want to avoid that especially this early on a project where we have the luxury and time of doing things right, even if it means banging heads against scss (again 😢)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I recall we added this back on DOL for a reason, but to be honest I don't remember what it is I just kept it the same. I would assume that we have less stuff here so probably the same conflict won't occur.

Comment on lines +30 to +43
const validationSchema = yup.object().shape({
address: yup.object().shape({
address1: yup.string().required(tCommon('validation.required')),
address2: yup.string().optional(),
city: yup.string().required(tCommon('validation.required')),
state: yup.string().required(tCommon('validation.required')),

zipcode: yup
.string()
// eslint-disable-next-line security/detect-unsafe-regex
.matches(/^\d{5}(-\d{4})?$/, tCommon('validation.notZipCode'))
.required(tCommon('validation.required')),
}),
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be defined again here when you have src/validations/address.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't the same schemas. I kept how we had it on DOL because I liked that the address only storybook had its own generic schema just for display and then when we used the object we made it more customized, min/max length. Any objection to keeping it that way?

Comment on lines +41 to +45
export const Default = Template.bind({})
Default.args = {
name: 'sample_phone',
label: 'Enter your phone number:',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So my note about the older syntax for stories can be seen in this example. The documentation now provides updated syntax (SB 7), while these examples are from storybook 6 and before. SB changes teh syntax every year it seems like, but lets go ahead and keep it all uniform with the latest style: https://storybook.js.org/docs/react/writing-stories/introduction

StoryFn isn't used anymore, and the Template.bind is also not used.

e.g this part would be something like

Suggested change
export const Default = Template.bind({})
Default.args = {
name: 'sample_phone',
label: 'Enter your phone number:',
}
export const PhoneNumberField: Story = {
render: () => // Your StoryFn contents here, or a call to it
}

Yes, the name PhoneNumberField is already taken, so import PhoneNumberField as PhoneNumberFieldComponent in this file (see ssn.stories.tsx). This naming convention matching the storybook story name displays the example without nesting it, which we should do if our only story is the default story

import { UntouchedRadioValue } from 'constants/formOptions'

export type YesNoInput = boolean | UntouchedRadioValue
// export type CheckboxInput = boolean | UntouchedCheckboxValue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

@@ -0,0 +1,63 @@
const common = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for consistency

Suggested change
const common = {
export default {

},
}

export default common
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export default common

Comment on lines +80 to +81
// Work Location

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
// Work Location
// Work Location

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a page to input employer information
2 participants