fhir-react 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.storybook/main.js +5 -0
  2. package/.storybook/manager.js +6 -0
  3. package/.storybook/preview.js +7 -0
  4. package/README.md +1 -1
  5. package/package.json +5 -4
  6. package/src/components/containers/Accordion/Accordion.stories.js +74 -58
  7. package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +43 -41
  8. package/src/components/defaultArgTypes.js +12 -0
  9. package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +17 -19
  10. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +46 -70
  11. package/src/components/resources/Appointment/Appointment.stories.js +51 -62
  12. package/src/components/resources/Binary/Binary.stories.js +27 -21
  13. package/src/components/resources/Bundle/Bundle.stories.js +59 -49
  14. package/src/components/resources/CarePlan/CarePlan.stories.js +44 -54
  15. package/src/components/resources/CareTeam/CareTeam.stories.js +22 -28
  16. package/src/components/resources/Claim/Claim.stories.js +36 -49
  17. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +42 -52
  18. package/src/components/resources/Condition/Condition.stories.js +47 -62
  19. package/src/components/resources/Coverage/Coverage.stories.js +38 -50
  20. package/src/components/resources/Device/Device.stories.js +40 -52
  21. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +38 -50
  22. package/src/components/resources/DocumentReference/DocumentReference.stories.js +25 -29
  23. package/src/components/resources/Encounter/Encounter.stories.js +43 -59
  24. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +53 -67
  25. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +74 -38
  26. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +22 -28
  27. package/src/components/resources/Generic/Generic.stories.js +21 -12
  28. package/src/components/resources/Goal/Goal.stories.js +35 -49
  29. package/src/components/resources/Immunization/Immunization.stories.js +38 -51
  30. package/src/components/resources/List/List.stories.js +66 -70
  31. package/src/components/resources/Location/Location.stories.js +23 -18
  32. package/src/components/resources/Medication/Medication.stories.js +42 -64
  33. package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +32 -46
  34. package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +39 -57
  35. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +49 -58
  36. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +11 -4
  37. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +27 -30
  38. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +32 -46
  39. package/src/components/resources/Observation/Observation.stories.js +39 -33
  40. package/src/components/resources/Organization/Organization.stories.js +40 -52
  41. package/src/components/resources/Patient/Patient.stories.js +36 -28
  42. package/src/components/resources/Practitioner/Practitioner.stories.js +39 -52
  43. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +43 -63
  44. package/src/components/resources/Procedure/Procedure.stories.js +33 -25
  45. package/src/components/resources/Questionnaire/Questionnaire.stories.js +47 -62
  46. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +43 -63
  47. package/src/components/resources/ReferralRequest/ReferralRequest.stories.js +20 -20
  48. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +26 -30
  49. package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +17 -15
  50. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +40 -27
  51. package/.storybook/addons.js +0 -1
  52. package/.storybook/config.js +0 -26
  53. package/.storybook/presets.js +0 -1
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ stories: ['../src/**/*.stories.@(js|mdx)'],
3
+ addons: ['@storybook/preset-scss', '@storybook/addon-controls'],
4
+ framework: '@storybook/react',
5
+ };
@@ -0,0 +1,6 @@
1
+ import { addons } from '@storybook/addons';
2
+
3
+ addons.setConfig({
4
+ name: 'FHIR-REACT storybook',
5
+ showRoots: false,
6
+ });
@@ -0,0 +1,7 @@
1
+ import '../src/components/ui/bootstrap-reboot.min.css';
2
+ import '../src/style.css';
3
+ import '../src/style.scss';
4
+
5
+ if (typeof document !== 'undefined') {
6
+ require('bootstrap/dist/js/bootstrap.min.js');
7
+ }
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![CircleCI](https://circleci.com/gh/1uphealth/fhir-react/tree/master.svg?style=svg)](https://circleci.com/gh/1uphealth/fhir-react/tree/master)
2
- [![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/release-0-3-9/index.html)
2
+ [![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/release-0-3-10/index.html)
3
3
 
4
4
  # fhir-react
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-react",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "React component library for displaying FHIR Resources ",
5
5
  "main": "build/index.js",
6
6
  "peerDependencies": {
@@ -10,6 +10,7 @@
10
10
  "@nivo/core": "^0.78.0",
11
11
  "@nivo/pie": "^0.78.0",
12
12
  "@popperjs/core": "^2.11.2",
13
+ "@storybook/addons": "^6.4.22",
13
14
  "bootstrap": "^5.1.3",
14
15
  "dompurify": "^2.3.6",
15
16
  "lodash": "^4.17.21",
@@ -82,10 +83,10 @@
82
83
  "@babel/polyfill": "^7.0.0",
83
84
  "@babel/preset-env": "^7.16.11",
84
85
  "@babel/preset-react": "^7.16.7",
85
- "@storybook/addon-knobs": "^5.2.8",
86
+ "@storybook/addon-controls": "^6.4.22",
86
87
  "@storybook/preset-scss": "^1.0.3",
87
- "@storybook/react": "^5.2.8",
88
- "@storybook/storybook-deployer": "^2.8.1",
88
+ "@storybook/react": "^6.4.22",
89
+ "@storybook/storybook-deployer": "^2.8.11",
89
90
  "@testing-library/react": "^12.1.4",
90
91
  "@typescript-eslint/eslint-plugin": "^5.14.0",
91
92
  "@typescript-eslint/parser": "^5.14.0",
@@ -1,76 +1,92 @@
1
+ import React from 'react';
2
+ import _get from 'lodash/get';
3
+
1
4
  import { BadgeSecondary, Body, MissingValue, Title, Value } from '../../ui';
2
5
 
3
6
  import Accordion from './Accordion';
4
7
  import Annotation from '../../datatypes/Annotation';
5
8
  import Date from '../../datatypes/Date';
6
- import Procedure from '../../resources/Procedure/Procedure';
7
- import React from 'react';
8
9
  import Reference from '../../datatypes/Reference';
9
- import _get from 'lodash/get';
10
+ import Procedure from '../../resources/Procedure/Procedure';
11
+
10
12
  import example1 from '../../../fixtures/dstu2/resources/procedure/example1.json';
11
- import fhirIcons from '../../../fixtures/example-icons';
12
- import { object } from '@storybook/addon-knobs';
13
13
  import stu3Example1 from '../../../fixtures/stu3/resources/procedure/example1.json';
14
+ import fhirIcons from '../../../fixtures/example-icons';
14
15
 
15
16
  export default {
16
17
  title: 'Accordion',
18
+ component: Accordion,
19
+ argTypes: {
20
+ headerContent: {
21
+ table: {
22
+ disable: true,
23
+ },
24
+ },
25
+ bodyContent: {
26
+ table: {
27
+ disable: true,
28
+ },
29
+ },
30
+ },
17
31
  };
18
32
 
19
- export const DefaultVisualization = () => {
20
- const fhirResource = object('Resource', stu3Example1);
21
- const title =
22
- _get(fhirResource, 'code.coding[0].display') ||
23
- _get(fhirResource, 'code.text');
24
- const performedDateTime = _get(fhirResource, 'performedDateTime');
25
- const performer = _get(fhirResource, 'performer', []);
26
- const locationReference = _get(fhirResource, 'location[0]');
27
- const reasonCode = _get(fhirResource, 'reasonCode', []);
28
- const note = _get(fhirResource, 'note', []);
33
+ const Template = args => <Accordion {...args} />;
29
34
 
30
- return (
31
- <Accordion
32
- headerContent={
33
- <div className="">
34
- <Title>{title}</Title>
35
- <div className="pb-3" />
36
- <BadgeSecondary data-testid="performedDateTime">
37
- <Date fhirData={performedDateTime} />
38
- </BadgeSecondary>
39
- </div>
40
- }
41
- bodyContent={
42
- <Body>
43
- <Value label="Performed by">
44
- {performer.map((item, i) => (
45
- <div key={`item-${i}`}>
46
- {_get(item, 'actor.display', <MissingValue />)}
47
- </div>
48
- ))}
49
- </Value>
50
- <Value label="Location" data-testid="location">
51
- <Reference fhirData={locationReference} />
52
- </Value>
53
- <Value label="Reason" data-testid="hasReasonCode">
54
- <Annotation fhirData={reasonCode} />
55
- </Value>
56
- <Value label="Notes" data-testid="hasNote">
57
- <Annotation fhirData={note} />
58
- </Value>
59
- </Body>
60
- }
61
- />
62
- );
35
+ const DefaultVisualizationFhirResource = stu3Example1;
36
+ export const DefaultVisualization = Template.bind({});
37
+ DefaultVisualization.args = {
38
+ headerContent: (
39
+ <div className="">
40
+ <Title>
41
+ {_get(DefaultVisualizationFhirResource, 'code.coding[0].display') ||
42
+ _get(DefaultVisualizationFhirResource, 'code.text')}
43
+ </Title>
44
+ <div className="pb-3" />
45
+ <BadgeSecondary data-testid="performedDateTime">
46
+ <Date
47
+ fhirData={_get(DefaultVisualizationFhirResource, 'performedDateTime')}
48
+ />
49
+ </BadgeSecondary>
50
+ </div>
51
+ ),
52
+ bodyContent: (
53
+ <Body>
54
+ <Value label="Performed by">
55
+ {_get(DefaultVisualizationFhirResource, 'performer', []).map(
56
+ (item, i) => (
57
+ <div key={`item-${i}`}>
58
+ {_get(item, 'actor.display', <MissingValue />)}
59
+ </div>
60
+ ),
61
+ )}
62
+ </Value>
63
+ <Value label="Location" data-testid="location">
64
+ <Reference
65
+ fhirData={_get(DefaultVisualizationFhirResource, 'location[0]')}
66
+ />
67
+ </Value>
68
+ <Value label="Reason" data-testid="hasReasonCode">
69
+ <Annotation
70
+ fhirData={_get(DefaultVisualizationFhirResource, 'reasonCode', [])}
71
+ />
72
+ </Value>
73
+ <Value label="Notes" data-testid="hasNote">
74
+ <Annotation
75
+ fhirData={_get(DefaultVisualizationFhirResource, 'note', [])}
76
+ />
77
+ </Value>
78
+ </Body>
79
+ ),
63
80
  };
64
81
 
65
- export const ProcedureVisualization = () => {
66
- const fhirResource = object('Resource', example1);
67
-
68
- return (
69
- <Accordion
70
- headerContent={<div className=""></div>}
71
- bodyContent={
72
- <Procedure fhirResource={fhirResource} fhirIcons={fhirIcons} />
73
- }
82
+ const ProcedureVisualizationFhirResource = example1;
83
+ export const ProcedureVisualization = Template.bind({});
84
+ ProcedureVisualization.args = {
85
+ headerContent: <div className="" />,
86
+ bodyContent: (
87
+ <Procedure
88
+ fhirResource={ProcedureVisualizationFhirResource}
89
+ fhirIcons={fhirIcons}
74
90
  />
75
- );
91
+ ),
76
92
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import ResourceContainer from './ResourceContainer';
5
5
  import Encounter from '../../../components/resources/Encounter';
@@ -10,50 +10,52 @@ import fhirVersions from '../../../components/resources/fhirResourceVersions';
10
10
 
11
11
  export default {
12
12
  title: 'ResourceContainer',
13
+ component: ResourceContainer,
14
+ argTypes: {
15
+ ...defaultArgTypes,
16
+ children: {
17
+ table: {
18
+ disable: true,
19
+ },
20
+ },
21
+ },
13
22
  };
14
23
 
15
- export const DefaultVisualizationWithRawButtonHiddenInsideAccordion = () => {
16
- const fhirResource = object('Resource', example1);
17
- const props = {
18
- fhirVersion: fhirVersions.DSTU2,
19
- fhirResource: fhirResource,
20
- };
21
- return (
22
- <ResourceContainer {...props}>
23
- <Encounter {...props} />
24
- </ResourceContainer>
25
- );
26
- };
27
-
28
- export const DefaultVisualizationWithRawButtonVisibleOutsideAccordion = () => {
29
- const exampleResource = {
30
- resourceType: 'UnknownResource',
31
- id: '12345',
32
- code: {
33
- text: 'Resource code text',
34
- },
35
- };
24
+ const Template = args => <ResourceContainer {...args} />;
36
25
 
37
- const fhirResource = object('Resource', exampleResource);
38
- const props = {
39
- fhirResource: fhirResource,
40
- };
26
+ const propsRawInsideAccordion = {
27
+ fhirVersion: fhirVersions.DSTU2,
28
+ fhirResource: example1,
29
+ };
30
+ export const DefaultVisualizationWithRawButtonHiddenInsideAccordion = Template.bind(
31
+ {},
32
+ );
33
+ DefaultVisualizationWithRawButtonHiddenInsideAccordion.args = {
34
+ ...propsRawInsideAccordion,
35
+ children: <Encounter {...propsRawInsideAccordion} />,
36
+ };
41
37
 
42
- return (
43
- <ResourceContainer {...props}>
44
- <Generic {...props} />
45
- </ResourceContainer>
46
- );
38
+ const exampleResource = {
39
+ resourceType: 'UnknownResource',
40
+ id: '12345',
41
+ code: {
42
+ text: 'Resource code text',
43
+ },
44
+ };
45
+ const propsRawOutsideAccordion = { fhirResource: exampleResource };
46
+ export const DefaultVisualizationWithRawButtonVisibleOutsideAccordion = Template.bind(
47
+ {},
48
+ );
49
+ DefaultVisualizationWithRawButtonVisibleOutsideAccordion.args = {
50
+ ...propsRawOutsideAccordion,
51
+ children: <Generic {...propsRawOutsideAccordion} />,
47
52
  };
48
53
 
49
- export const VisualizationWithoutFhirVersion = () => {
50
- const fhirResource = object('Resource', example1);
51
- const props = {
52
- fhirResource: fhirResource,
53
- };
54
- return (
55
- <ResourceContainer {...props}>
56
- <Encounter {...props} />
57
- </ResourceContainer>
58
- );
54
+ const propsWithoutVersion = {
55
+ fhirResource: example1,
56
+ };
57
+ export const VisualizationWithoutFhirVersion = Template.bind({});
58
+ VisualizationWithoutFhirVersion.args = {
59
+ ...propsWithoutVersion,
60
+ children: <Encounter {...propsWithoutVersion} />,
59
61
  };
@@ -0,0 +1,12 @@
1
+ export const defaultArgTypes = {
2
+ fhirVersion: {
3
+ table: {
4
+ disable: true,
5
+ },
6
+ },
7
+ fhirIcons: {
8
+ table: {
9
+ disable: true,
10
+ },
11
+ },
12
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import AdverseEvent from './AdverseEvent';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -11,26 +11,24 @@ import fhirIcons from '../../../fixtures/example-icons';
11
11
 
12
12
  export default {
13
13
  title: 'AdverseEvent',
14
+ component: AdverseEvent,
15
+ argTypes: {
16
+ ...defaultArgTypes,
17
+ },
14
18
  };
15
19
 
16
- export const DefaultVisualizationSTU3 = () => {
17
- const fhirResource = object('Resource', stu3Example1);
18
- return (
19
- <AdverseEvent
20
- fhirResource={fhirResource}
21
- fhirVersion={fhirVersions.STU3}
22
- fhirIcons={fhirIcons}
23
- />
24
- );
20
+ const Template = args => <AdverseEvent {...args} />;
21
+
22
+ export const DefaultVisualizationSTU3 = Template.bind({});
23
+ DefaultVisualizationSTU3.args = {
24
+ fhirVersion: fhirVersions.STU3,
25
+ fhirResource: stu3Example1,
26
+ fhirIcons: fhirIcons,
25
27
  };
26
28
 
27
- export const Example1ofR4 = () => {
28
- const fhirResource = object('Resource', r4Example1);
29
- return (
30
- <AdverseEvent
31
- fhirResource={fhirResource}
32
- fhirVersion={fhirVersions.R4}
33
- fhirIcons={false}
34
- />
35
- );
29
+ export const Example1ofR4 = Template.bind({});
30
+ Example1ofR4.args = {
31
+ fhirVersion: fhirVersions.R4,
32
+ fhirResource: r4Example1,
33
+ fhirIcons: false,
36
34
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import AllergyIntolerance from './AllergyIntolerance';
5
5
 
@@ -14,88 +14,64 @@ import fhirIcons from '../../../fixtures/example-icons';
14
14
  import fhirVersions from '../fhirResourceVersions';
15
15
  import AllergyIntoleranceIcon from '../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg';
16
16
 
17
- export default { title: 'AllergyIntolerance' };
17
+ export default {
18
+ title: 'AllergyIntolerance',
19
+ component: AllergyIntolerance,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <AllergyIntolerance {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', exampleAllergyIntoleranceDSTU2);
21
- return (
22
- <AllergyIntolerance
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg')}
26
- />
27
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirVersion: fhirVersions.DSTU2,
30
+ fhirResource: exampleAllergyIntoleranceDSTU2,
31
+ fhirIcons: require('../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg'),
28
32
  };
29
33
 
30
- export const Example2ofDSTU2 = () => {
31
- const fhirResource = object('Resource', example2AllergyIntoleranceDSTU2);
32
- return (
33
- <AllergyIntolerance
34
- fhirVersion={fhirVersions.DSTU2}
35
- fhirResource={fhirResource}
36
- fhirIcons={AllergyIntoleranceIcon}
37
- />
38
- );
34
+ export const Example2ofDSTU2 = Template.bind({});
35
+ Example2ofDSTU2.args = {
36
+ fhirVersion: fhirVersions.DSTU2,
37
+ fhirResource: example2AllergyIntoleranceDSTU2,
38
+ fhirIcons: AllergyIntoleranceIcon,
39
39
  };
40
40
 
41
- export const ExampleDiagnosticReportSTU3 = () => {
42
- const fhirResource = object('Resource', exampleAllergyIntoleranceSTU3);
43
- return (
44
- <AllergyIntolerance
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
41
+ export const ExampleDiagnosticReportSTU3 = Template.bind({});
42
+ ExampleDiagnosticReportSTU3.args = {
43
+ fhirVersion: fhirVersions.STU3,
44
+ fhirResource: exampleAllergyIntoleranceSTU3,
45
+ fhirIcons: fhirIcons,
50
46
  };
51
47
 
52
- export const Example2DiagnosticReportSTU3 = () => {
53
- const fhirResource = object('Resource', example2AllergyIntoleranceSTU3);
54
- return (
55
- <AllergyIntolerance
56
- fhirVersion={fhirVersions.STU3}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
48
+ export const Example2DiagnosticReportSTU3 = Template.bind({});
49
+ Example2DiagnosticReportSTU3.args = {
50
+ fhirVersion: fhirVersions.STU3,
51
+ fhirResource: example2AllergyIntoleranceSTU3,
52
+ fhirIcons: false,
61
53
  };
62
54
 
63
- export const Example1R4 = () => {
64
- const fhirResource = object('Resource', example1AllergyIntoleranceR4);
65
- return (
66
- <AllergyIntolerance
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
55
+ export const Example1R4 = Template.bind({});
56
+ Example1R4.args = {
57
+ fhirVersion: fhirVersions.R4,
58
+ fhirResource: example1AllergyIntoleranceR4,
59
+ fhirIcons: 'random text',
72
60
  };
73
61
 
74
- export const Example2R4 = () => {
75
- const fhirResource = object('Resource', example2AllergyIntoleranceR4);
76
- return (
77
- <AllergyIntolerance
78
- fhirVersion={fhirVersions.R4}
79
- fhirResource={fhirResource}
80
- fhirIcons={fhirIcons}
81
- />
82
- );
62
+ export const Example2R4 = Template.bind({});
63
+ Example2R4.args = {
64
+ fhirVersion: fhirVersions.R4,
65
+ fhirResource: example2AllergyIntoleranceR4,
83
66
  };
84
67
 
85
- export const Example3R4 = () => {
86
- const fhirResource = object('Resource', example3AllergyIntoleranceR4);
87
- return (
88
- <AllergyIntolerance
89
- fhirVersion={fhirVersions.R4}
90
- fhirResource={fhirResource}
91
- fhirIcons={fhirIcons}
92
- />
93
- );
68
+ export const Example3R4 = Template.bind({});
69
+ Example3R4.args = {
70
+ fhirVersion: fhirVersions.R4,
71
+ fhirResource: example3AllergyIntoleranceR4,
94
72
  };
95
73
 
96
- export const ExampleWithoutFhirVersionProperty = () => {
97
- const fhirResource = object('Resource', example2AllergyIntoleranceSTU3);
98
- return (
99
- <AllergyIntolerance fhirResource={fhirResource} fhirIcons={fhirIcons} />
100
- );
74
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
75
+ ExampleWithoutFhirVersionProperty.args = {
76
+ fhirResource: example2AllergyIntoleranceSTU3,
101
77
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
  import fhirVersions from '../fhirResourceVersions';
4
4
 
5
5
  import Appointment from './Appointment';
@@ -16,76 +16,65 @@ import example3AppointmentR4 from '../../../fixtures/r4/resources/appointment/ex
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
  import AppointmentIcon from '../../../assets/containers/Appointment/appointment.svg';
18
18
 
19
- export default { title: 'Appointment' };
19
+ export default {
20
+ title: 'Appointment',
21
+ component: Appointment,
22
+ argTypes: {
23
+ ...defaultArgTypes,
24
+ },
25
+ };
26
+
27
+ const Template = args => <Appointment {...args} />;
20
28
 
21
- export const DefaultVisualizationDSTU2 = () => {
22
- const fhirResource = object('Resource', exampleAppointmentDSTU2);
23
- return (
24
- <Appointment
25
- fhirResource={fhirResource}
26
- fhirVersion={fhirVersions.DSTU2}
27
- fhirIcons={require('../../../assets/containers/Appointment/appointment.svg')}
28
- />
29
- );
29
+ export const DefaultVisualizationDSTU2 = Template.bind({});
30
+ DefaultVisualizationDSTU2.args = {
31
+ fhirResource: exampleAppointmentDSTU2,
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirIcons: require('../../../assets/containers/Appointment/appointment.svg'),
30
34
  };
31
35
 
32
- export const Example2OfDSTU2 = () => {
33
- const fhirResource = object('Resource', example2AppointmentDSTU2);
34
- return (
35
- <Appointment
36
- fhirResource={fhirResource}
37
- fhirVersion={fhirVersions.DSTU2}
38
- fhirIcons={AppointmentIcon}
39
- />
40
- );
36
+ export const Example2OfDSTU2 = Template.bind({});
37
+ Example2OfDSTU2.args = {
38
+ fhirResource: example2AppointmentDSTU2,
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirIcons: AppointmentIcon,
41
41
  };
42
42
 
43
- export const Example1OfSTU3 = () => {
44
- const fhirResource = object('Resource', example1AppointmentSTU3);
45
- return (
46
- <Appointment
47
- fhirResource={fhirResource}
48
- fhirVersion={fhirVersions.STU3}
49
- fhirIcons={fhirIcons}
50
- />
51
- );
43
+ export const Example1OfSTU3 = Template.bind({});
44
+ Example1OfSTU3.args = {
45
+ fhirResource: example1AppointmentSTU3,
46
+ fhirVersion: fhirVersions.STU3,
47
+ fhirIcons: fhirIcons,
52
48
  };
53
- export const Example2OfSTU3 = () => {
54
- const fhirResource = object('Resource', example2AppointmentSTU3);
55
- return (
56
- <Appointment
57
- fhirResource={fhirResource}
58
- fhirVersion={fhirVersions.STU3}
59
- fhirIcons={false}
60
- />
61
- );
49
+
50
+ export const Example2OfSTU3 = Template.bind({});
51
+ Example2OfSTU3.args = {
52
+ fhirResource: example2AppointmentSTU3,
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirIcons: false,
62
55
  };
63
- export const Example3OfSTU3 = () => {
64
- const fhirResource = object('Resource', example3AppointmentSTU3);
65
- return (
66
- <Appointment
67
- fhirResource={fhirResource}
68
- fhirVersion={fhirVersions.STU3}
69
- fhirIcons={'random text'}
70
- />
71
- );
56
+
57
+ export const Example3OfSTU3 = Template.bind({});
58
+ Example3OfSTU3.args = {
59
+ fhirResource: example3AppointmentSTU3,
60
+ fhirVersion: fhirVersions.STU3,
61
+ fhirIcons: 'random text',
72
62
  };
73
63
 
74
- export const Example1OfR4 = () => {
75
- const fhirResource = object('Resource', example1AppointmentR4);
76
- return (
77
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
78
- );
64
+ export const Example1OfR4 = Template.bind({});
65
+ Example1OfR4.args = {
66
+ fhirResource: example1AppointmentR4,
67
+ fhirVersion: fhirVersions.R4,
79
68
  };
80
- export const Example2OfR4 = () => {
81
- const fhirResource = object('Resource', example2AppointmentR4);
82
- return (
83
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
84
- );
69
+
70
+ export const Example2OfR4 = Template.bind({});
71
+ Example2OfR4.args = {
72
+ fhirResource: example2AppointmentR4,
73
+ fhirVersion: fhirVersions.R4,
85
74
  };
86
- export const Example3OfR4 = () => {
87
- const fhirResource = object('Resource', example3AppointmentR4);
88
- return (
89
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
90
- );
75
+
76
+ export const Example3OfR4 = Template.bind({});
77
+ Example3OfR4.args = {
78
+ fhirResource: example3AppointmentR4,
79
+ fhirVersion: fhirVersions.R4,
91
80
  };