Skip to content

Commit

Permalink
Add stories for QuestionQuantity widget
Browse files Browse the repository at this point in the history
Refs: #323
  • Loading branch information
atuonufure committed Nov 5, 2024
1 parent 23b63a7 commit fe04b48
Showing 1 changed file with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Meta, StoryObj } from '@storybook/react';
import { ItemContext } from 'sdc-qrf/lib/types';

import { WithQuestionFormProviderDecorator, withColorSchemeDecorator } from 'src/storybook/decorators';

import { QuestionQuantity } from './index';

const meta: Meta<typeof QuestionQuantity> = {
title: 'Questionnaire / questions / quantity',
component: QuestionQuantity,
decorators: [withColorSchemeDecorator, WithQuestionFormProviderDecorator],
};

export default meta;
type Story = StoryObj<typeof QuestionQuantity>;

export const Example: Story = {
render: () => (
<QuestionQuantity
parentPath={[]}
questionItem={{
text: 'Example',
type: 'quantity',
linkId: 'example',
required: true,
unitOption: [
{
code: 'foot',
system: 'http://unitsofmeasure.org',
display: 'ft',
},
{
code: 'inch',
system: 'http://unitsofmeasure.org',
display: 'in',
},
{
code: 'cm',
system: 'http://unitsofmeasure.org',
display: 'cm',
},
],
}}
context={{} as ItemContext}
/>
),
};

export const Single: Story = {
render: () => (
<QuestionQuantity
parentPath={[]}
questionItem={{
text: 'Example',
type: 'quantity',
linkId: 'example',
required: true,
unitOption: [
{
code: 'foot',
system: 'http://unitsofmeasure.org',
display: 'ft',
},
],
}}
context={{} as ItemContext}
/>
),
};

0 comments on commit fe04b48

Please sign in to comment.