Skip to content

Commit

Permalink
feat: 🎸 Created a separate story which has dropdown questions
Browse files Browse the repository at this point in the history
Created a separate story for the dropdown that has questions

BREAKING CHANGE: 🧨 No

✅ Closes: #887
  • Loading branch information
MudassarRaza774 committed Jul 11, 2023
1 parent 66c2a04 commit ab2b130
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions stories/SQFormDropdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,36 @@ const MOCK_STATE_OPTIONS = [
{label: 'Missouri', value: 'MO'},
];

const MOCK_CONFIRMATION_OPTIONS = [
{label: 'Yes', value: 1},
{label: 'No', value: 0},
];

const questions = [
'What benefits do you use more often?',
"Are there benefits that you don't use today, but would like to learn if you have them?",
'Are there any quesions that you have about your plan?',
];

const defaultArgs = {
label: 'Is there anything else you would like your plan to do for you?',
label: 'State',
name: 'state',
children: MOCK_STATE_OPTIONS,
sqFormProps: {
initialValues: {state: ''},
},
};

const argsWithQuestions = {
name: 'plans',
label: 'Is there anything else you would like your plan to do for you?',
children: MOCK_CONFIRMATION_OPTIONS,
questions: questions,
sqFormProps: {
initialValues: {plans: ''},
},
};

const validationSchema = Yup.object({
[defaultArgs.name]: Yup.string().required('Required'),
});
Expand All @@ -76,11 +91,7 @@ const Template: DropdownStoryType = (args) => {
validationSchema={schema}
{...sqFormProps}
>
<SQFormDropdownComponent
{...dropdownProps}
size={getSizeProp(size)}
questions={questions}
/>
<SQFormDropdownComponent {...dropdownProps} size={getSizeProp(size)} />
</SQFormStoryWrapper>
</div>
);
Expand All @@ -99,4 +110,8 @@ WithValidation.parameters = {
controls: {exclude: 'schema'},
};

export const withQuestion = Template.bind({});
withQuestion.args = argsWithQuestions;
withQuestion.storyName = 'Dropdown with Question';

export default meta;

0 comments on commit ab2b130

Please sign in to comment.