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
@@ -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 MedicationKnowledge from './MedicationKnowledge';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -13,72 +13,63 @@ import MedicationKnowledgeIcon from '../../../assets/containers/MedicationKnowle
13
13
 
14
14
  export default {
15
15
  title: 'MedicationKnowledge',
16
+ component: MedicationKnowledge,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ withDaVinciPDex: {
20
+ table: {
21
+ disable: true,
22
+ },
23
+ },
24
+ },
16
25
  };
17
26
 
18
- export const DefaultVisualizationR4 = () => {
19
- const fhirResource = object('Resource', example1R4);
20
- return (
21
- <MedicationKnowledge
22
- fhirVersion={fhirVersions.R4}
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/MedicationKnowledge/medication-knowledge.svg')}
25
- />
26
- );
27
+ const Template = args => <MedicationKnowledge {...args} />;
28
+
29
+ export const DefaultVisualizationR4 = Template.bind({});
30
+ DefaultVisualizationR4.args = {
31
+ fhirVersion: fhirVersions.R4,
32
+ fhirResource: example1R4,
33
+ fhirIcons: require('../../../assets/containers/MedicationKnowledge/medication-knowledge.svg'),
27
34
  };
28
- export const ExampleR4WithoutDaVinciPDex = () => {
29
- const fhirResource = object('Resource', example2R4);
30
- return (
31
- <MedicationKnowledge
32
- fhirVersion={fhirVersions.R4}
33
- fhirResource={fhirResource}
34
- fhirIcons={MedicationKnowledgeIcon}
35
- />
36
- );
35
+
36
+ export const ExampleR4WithoutDaVinciPDex = Template.bind({});
37
+ ExampleR4WithoutDaVinciPDex.args = {
38
+ fhirVersion: fhirVersions.R4,
39
+ fhirResource: example2R4,
40
+ fhirIcons: MedicationKnowledgeIcon,
37
41
  };
38
- export const ExampleR4WithDaVinciPDex = () => {
39
- const fhirResource = object('Resource', example2R4);
40
- return (
41
- <MedicationKnowledge
42
- fhirVersion={fhirVersions.R4}
43
- fhirResource={fhirResource}
44
- withDaVinciPDex
45
- fhirIcons={fhirIcons}
46
- />
47
- );
42
+
43
+ export const ExampleR4WithDaVinciPDex = Template.bind({});
44
+ ExampleR4WithDaVinciPDex.args = {
45
+ fhirVersion: fhirVersions.R4,
46
+ fhirResource: example2R4,
47
+ fhirIcons: fhirIcons,
48
+ withDaVinciPDex: true,
48
49
  };
49
- export const Example2R4 = () => {
50
- const fhirResource = object('Resource', example3R4);
51
- return (
52
- <MedicationKnowledge
53
- fhirVersion={fhirVersions.R4}
54
- fhirResource={fhirResource}
55
- />
56
- );
50
+
51
+ export const Example2R4 = Template.bind({});
52
+ Example2R4.args = {
53
+ fhirVersion: fhirVersions.R4,
54
+ fhirResource: example3R4,
55
+ fhirIcons: false,
57
56
  };
58
57
 
59
- export const Example3R4WithDaVinciPDex = () => {
60
- const fhirResource = object('Resource', example4R4);
61
- return (
62
- <MedicationKnowledge
63
- fhirVersion={fhirVersions.R4}
64
- fhirResource={fhirResource}
65
- withDaVinciPDex
66
- fhirIcons={false}
67
- />
68
- );
58
+ export const Example3R4WithDaVinciPDex = Template.bind({});
59
+ Example3R4WithDaVinciPDex.args = {
60
+ fhirVersion: fhirVersions.R4,
61
+ fhirResource: example4R4,
62
+ fhirIcons: 'random text',
63
+ withDaVinciPDex: true,
69
64
  };
70
65
 
71
- export const ExampleWithoutFHIRVersionProperty = () => {
72
- const fhirResource = object('Resource', example3R4);
73
- return <MedicationKnowledge fhirResource={fhirResource} />;
66
+ export const ExampleWithoutFHIRVersionProperty = Template.bind({});
67
+ ExampleWithoutFHIRVersionProperty.args = {
68
+ fhirResource: example3R4,
74
69
  };
75
70
 
76
- export const ExampleWithUnsupportedFHIRVersionProperty = () => {
77
- const fhirResource = object('Resource', example4R4);
78
- return (
79
- <MedicationKnowledge
80
- fhirVersion={fhirVersions.DSTU2}
81
- fhirResource={fhirResource}
82
- />
83
- );
71
+ export const ExampleWithUnsupportedFHIRVersionProperty = Template.bind({});
72
+ ExampleWithUnsupportedFHIRVersionProperty.args = {
73
+ fhirVersion: fhirVersions.DSTU2,
74
+ fhirResource: example4R4,
84
75
  };
@@ -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 MedicationOrder from './MedicationOrder';
5
5
 
@@ -7,9 +7,16 @@ import dstu2Example from '../../../fixtures/dstu2/resources/medicationOrder/exam
7
7
 
8
8
  export default {
9
9
  title: 'MedicationOrder',
10
+ component: MedicationOrder,
11
+ argTypes: {
12
+ ...defaultArgTypes,
13
+ },
10
14
  };
11
15
 
12
- export const DefaultVisualizationDSTU2 = () => {
13
- const fhirResource = object('Resource', dstu2Example);
14
- return <MedicationOrder fhirResource={fhirResource} />;
16
+ const Template = args => <MedicationOrder {...args} />;
17
+
18
+ export const DefaultVisualizationDSTU2 = Template.bind({});
19
+ DefaultVisualizationDSTU2.args = {
20
+ fhirResource: dstu2Example,
21
+ fhirIcons: require('../../../assets/containers/MedicationOrder/medication-order.svg'),
15
22
  };
@@ -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 MedicationRequest from './MedicationRequest';
5
5
 
@@ -13,43 +13,40 @@ import MedicationRequestIcon from '../../../assets/containers/MedicationRequest/
13
13
 
14
14
  export default {
15
15
  title: 'MedicationRequest',
16
+ component: MedicationRequest,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ },
16
20
  };
17
21
 
18
- export const DefaultVisualizationSTU3 = () => {
19
- const fhirResource = object('Resource', stu3Example1);
20
- return (
21
- <MedicationRequest
22
- fhirResource={fhirResource}
23
- fhirIcons={require('../../../assets/containers/MedicationRequest/medication-request.svg')}
24
- />
25
- );
22
+ const Template = args => <MedicationRequest {...args} />;
23
+
24
+ export const DefaultVisualizationSTU3 = Template.bind({});
25
+ DefaultVisualizationSTU3.args = {
26
+ fhirResource: stu3Example1,
27
+ fhirIcons: require('../../../assets/containers/MedicationRequest/medication-request.svg'),
26
28
  };
27
29
 
28
- export const Example2OfSTU3 = () => {
29
- const fhirResource = object('Resource', stu3Example2);
30
- return (
31
- <MedicationRequest
32
- fhirResource={fhirResource}
33
- fhirIcons={MedicationRequestIcon}
34
- />
35
- );
30
+ export const Example2OfSTU3 = Template.bind({});
31
+ Example2OfSTU3.args = {
32
+ fhirResource: stu3Example2,
33
+ fhirIcons: MedicationRequestIcon,
36
34
  };
37
35
 
38
- export const Example1OfR4 = () => {
39
- const fhirResource = object('Resource', R4Example1);
40
- return (
41
- <MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
42
- );
36
+ export const Example1OfR4 = Template.bind({});
37
+ Example1OfR4.args = {
38
+ fhirResource: R4Example1,
39
+ fhirIcons: fhirIcons,
43
40
  };
44
41
 
45
- export const Example2OfR4 = () => {
46
- const fhirResource = object('Resource', R4Example2);
47
- return <MedicationRequest fhirResource={fhirResource} fhirIcons={false} />;
42
+ export const Example2OfR4 = Template.bind({});
43
+ Example2OfR4.args = {
44
+ fhirResource: R4Example2,
45
+ fhirIcons: false,
48
46
  };
49
47
 
50
- export const Example3OfR4 = () => {
51
- const fhirResource = object('Resource', R4Example3);
52
- return (
53
- <MedicationRequest fhirResource={fhirResource} fhirIcons={'random text'} />
54
- );
48
+ export const Example3OfR4 = Template.bind({});
49
+ Example3OfR4.args = {
50
+ fhirResource: R4Example3,
51
+ fhirIcons: 'random text',
55
52
  };
@@ -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 MedicationStatement from './MedicationStatement';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -14,59 +14,45 @@ import MedicationStatementIcon from '../../../assets/containers/MedicationStatem
14
14
 
15
15
  export default {
16
16
  title: 'MedicationStatement',
17
+ component: MedicationStatement,
18
+ argTypes: {
19
+ ...defaultArgTypes,
20
+ },
17
21
  };
18
22
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', dstu2Example1);
21
- return (
22
- <MedicationStatement
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/MedicationStatement/medication-statement.svg')}
26
- />
27
- );
23
+ const Template = args => <MedicationStatement {...args} />;
24
+
25
+ export const DefaultVisualizationDSTU2 = Template.bind({});
26
+ DefaultVisualizationDSTU2.args = {
27
+ fhirVersion: fhirVersions.DSTU2,
28
+ fhirResource: dstu2Example1,
29
+ fhirIcons: require('../../../assets/containers/MedicationStatement/medication-statement.svg'),
28
30
  };
29
31
 
30
- export const ExampleOfSTU3 = () => {
31
- const fhirResource = object('Resource', stu3Example1);
32
- return (
33
- <MedicationStatement
34
- fhirVersion={fhirVersions.STU3}
35
- fhirResource={fhirResource}
36
- fhirIcons={MedicationStatementIcon}
37
- />
38
- );
32
+ export const ExampleOfSTU3 = Template.bind({});
33
+ ExampleOfSTU3.args = {
34
+ fhirVersion: fhirVersions.STU3,
35
+ fhirResource: stu3Example1,
36
+ fhirIcons: MedicationStatementIcon,
39
37
  };
40
38
 
41
- export const Example2OfSTU3 = () => {
42
- const fhirResource = object('Resource', stu3Example2);
43
- return (
44
- <MedicationStatement
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
39
+ export const Example2OfSTU3 = Template.bind({});
40
+ Example2OfSTU3.args = {
41
+ fhirVersion: fhirVersions.STU3,
42
+ fhirResource: stu3Example2,
43
+ fhirIcons: fhirIcons,
50
44
  };
51
45
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', r4Example1);
54
- return (
55
- <MedicationStatement
56
- fhirVersion={fhirVersions.R4}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
46
+ export const Example1OfR4 = Template.bind({});
47
+ Example1OfR4.args = {
48
+ fhirVersion: fhirVersions.R4,
49
+ fhirResource: r4Example1,
50
+ fhirIcons: false,
61
51
  };
62
52
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <MedicationStatement
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
53
+ export const Example2OfR4 = Template.bind({});
54
+ Example2OfR4.args = {
55
+ fhirVersion: fhirVersions.R4,
56
+ fhirResource: r4Example2,
57
+ fhirIcons: 'random text',
72
58
  };
@@ -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 Observation from './Observation';
5
5
 
@@ -15,51 +15,57 @@ import example3ObservationExcessR4 from '../../../fixtures/r4/resources/observat
15
15
  import ObservationIcon from '../../../assets/containers/Observation/observation.svg';
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
 
18
- export default { title: 'Observation' };
18
+ export default {
19
+ title: 'Observation',
20
+ component: Observation,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <Observation {...args} />;
19
27
 
20
- export const DefaultVisualizationDSTU2 = () => {
21
- const fhirResource = object('Resource', exampleObservationIssued);
22
- return (
23
- <Observation
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Observation/observation.svg')}
26
- />
27
- );
28
+ export const DefaultVisualizationDSTU2 = Template.bind({});
29
+ DefaultVisualizationDSTU2.args = {
30
+ fhirResource: exampleObservationIssued,
31
+ fhirIcons: require('../../../assets/containers/Observation/observation.svg'),
28
32
  };
29
33
 
30
- export const ExampleWithoutIssuedDSTU2 = () => {
31
- const fhirResource = object('Resource', exampleObservation);
32
- return (
33
- <Observation fhirResource={fhirResource} fhirIcons={ObservationIcon} />
34
- );
34
+ export const ExampleWithoutIssuedDSTU2 = Template.bind({});
35
+ ExampleWithoutIssuedDSTU2.args = {
36
+ fhirResource: exampleObservation,
37
+ fhirIcons: ObservationIcon,
35
38
  };
36
39
 
37
- export const ExampleWithIssuedSTU3 = () => {
38
- const fhirResource = object('Resource', exampleObservationExcessSTU3);
39
- return <Observation fhirResource={fhirResource} fhirIcons={fhirIcons} />;
40
+ export const ExampleWithIssuedSTU3 = Template.bind({});
41
+ ExampleWithIssuedSTU3.args = {
42
+ fhirResource: exampleObservationExcessSTU3,
43
+ fhirIcons: fhirIcons,
40
44
  };
41
45
 
42
- export const ExampleWithoutIssuedSTU3 = () => {
43
- const fhirResource = object('Resource', exampleObservationSTU3);
44
- return <Observation fhirResource={fhirResource} fhirIcons={false} />;
46
+ export const ExampleWithoutIssuedSTU3 = Template.bind({});
47
+ ExampleWithoutIssuedSTU3.args = {
48
+ fhirResource: exampleObservationSTU3,
49
+ fhirIcons: false,
45
50
  };
46
51
 
47
- export const Example3OfSTU3 = () => {
48
- const fhirResource = object('Resource', example3ObservationExcessSTU3);
49
- return <Observation fhirResource={fhirResource} fhirIcons={'random text'} />;
52
+ export const Example3OfSTU3 = Template.bind({});
53
+ Example3OfSTU3.args = {
54
+ fhirResource: example3ObservationExcessSTU3,
55
+ fhirIcons: 'random text',
50
56
  };
51
57
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', example1ObservationExcessR4);
54
- return <Observation fhirResource={fhirResource} />;
58
+ export const Example1OfR4 = Template.bind({});
59
+ Example1OfR4.args = {
60
+ fhirResource: example1ObservationExcessR4,
55
61
  };
56
62
 
57
- export const Example2OfR4 = () => {
58
- const fhirResource = object('Resource', example2ObservationExcessR4);
59
- return <Observation fhirResource={fhirResource} />;
63
+ export const Example2OfR4 = Template.bind({});
64
+ Example2OfR4.args = {
65
+ fhirResource: example2ObservationExcessR4,
60
66
  };
61
67
 
62
- export const Example3OfR4 = () => {
63
- const fhirResource = object('Resource', example3ObservationExcessR4);
64
- return <Observation fhirResource={fhirResource} />;
68
+ export const Example3OfR4 = Template.bind({});
69
+ Example3OfR4.args = {
70
+ fhirResource: example3ObservationExcessR4,
65
71
  };
@@ -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 Organization from './Organization';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -19,69 +19,57 @@ import OrganizationIcon from '../../../assets/containers/Organization/organizati
19
19
 
20
20
  export default {
21
21
  title: 'Organization',
22
+ component: Organization,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ },
22
26
  };
23
27
 
24
- export const DefaultVisualizationDSTU2 = () => {
25
- const fhirResource = object('Resource', dstu2Example1);
26
- return (
27
- <Organization
28
- fhirResource={fhirResource}
29
- fhirVersion={fhirVersions.DSTU2}
30
- fhirIcons={OrganizationIcon}
31
- />
32
- );
28
+ const Template = args => <Organization {...args} />;
29
+
30
+ export const DefaultVisualizationDSTU2 = Template.bind({});
31
+ DefaultVisualizationDSTU2.args = {
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirResource: dstu2Example1,
34
+ fhirIcons: require('../../../assets/containers/Organization/organization.svg'),
33
35
  };
34
36
 
35
- export const Example2OfDSTU2 = () => {
36
- const fhirResource = object('Resource', dstu2Example2);
37
- return (
38
- <Organization
39
- fhirResource={fhirResource}
40
- fhirVersion={fhirVersions.DSTU2}
41
- fhirIcons={fhirIcons}
42
- />
43
- );
37
+ export const Example2OfDSTU2 = Template.bind({});
38
+ Example2OfDSTU2.args = {
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirResource: dstu2Example2,
41
+ fhirIcons: OrganizationIcon,
44
42
  };
45
43
 
46
- export const Example1OfSTU3 = () => {
47
- const fhirResource = object('Resource', stu3Example1);
48
- return (
49
- <Organization
50
- fhirResource={fhirResource}
51
- fhirVersion={fhirVersions.STU3}
52
- fhirIcons={false}
53
- />
54
- );
44
+ export const Example1OfSTU3 = Template.bind({});
45
+ Example1OfSTU3.args = {
46
+ fhirVersion: fhirVersions.STU3,
47
+ fhirResource: stu3Example1,
48
+ fhirIcons: fhirIcons,
55
49
  };
56
50
 
57
- export const Example2OfSTU3 = () => {
58
- const fhirResource = object('Resource', stu3Example2);
59
- return (
60
- <Organization
61
- fhirResource={fhirResource}
62
- fhirVersion={fhirVersions.STU3}
63
- fhirIcons={'random text'}
64
- />
65
- );
51
+ export const Example2OfSTU3 = Template.bind({});
52
+ Example2OfSTU3.args = {
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirResource: stu3Example2,
55
+ fhirIcons: false,
66
56
  };
67
57
 
68
- export const Example1OfR4 = () => {
69
- const fhirResource = object('Resource', r4Example1);
70
- return (
71
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
72
- );
58
+ export const Example1OfR4 = Template.bind({});
59
+ Example1OfR4.args = {
60
+ fhirVersion: fhirVersions.R4,
61
+ fhirResource: r4Example1,
62
+ fhirIcons: 'random text',
73
63
  };
74
64
 
75
- export const Example2OfR4 = () => {
76
- const fhirResource = object('Resource', r4Example2);
77
- return (
78
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
79
- );
65
+ export const Example2OfR4 = Template.bind({});
66
+ Example2OfR4.args = {
67
+ fhirVersion: fhirVersions.R4,
68
+ fhirResource: r4Example2,
80
69
  };
81
70
 
82
- export const Example3OfR4 = () => {
83
- const fhirResource = object('Resource', r4Example3);
84
- return (
85
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
86
- );
71
+ export const Example3OfR4 = Template.bind({});
72
+ Example3OfR4.args = {
73
+ fhirVersion: fhirVersions.R4,
74
+ fhirResource: r4Example3,
87
75
  };
@@ -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 Patient from './Patient';
5
5
 
@@ -15,44 +15,52 @@ import example3PatientR4 from '../../../fixtures/r4/resources/patient/example3.j
15
15
  import PatientIcon from '../../../assets/containers/Patient/patient.svg';
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
 
18
- export default { title: 'Patient' };
18
+ export default {
19
+ title: 'Patient',
20
+ component: Patient,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <Patient {...args} />;
19
27
 
20
- export const DefaultVisualizationDSTU2 = () => {
21
- const fhirResource = object('Resource', examplePatient);
22
- return (
23
- <Patient
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Patient/patient.svg')}
26
- />
27
- );
28
+ export const DefaultVisualizationDSTU2 = Template.bind({});
29
+ DefaultVisualizationDSTU2.args = {
30
+ fhirResource: examplePatient,
31
+ fhirIcons: require('../../../assets/containers/Patient/patient.svg'),
28
32
  };
29
33
 
30
- export const Example2OfDSTU2 = () => {
31
- const fhirResource = object('Resource', example2PatientDSTU2);
32
- return <Patient fhirResource={fhirResource} fhirIcons={PatientIcon} />;
34
+ export const Example2OfDSTU2 = Template.bind({});
35
+ Example2OfDSTU2.args = {
36
+ fhirResource: example2PatientDSTU2,
37
+ fhirIcons: PatientIcon,
33
38
  };
34
39
 
35
- export const ExampleSTU3 = () => {
36
- const fhirResource = object('Resource', examplePatientSTU3);
37
- return <Patient fhirResource={fhirResource} fhirIcons={fhirIcons} />;
40
+ export const ExampleSTU3 = Template.bind({});
41
+ ExampleSTU3.args = {
42
+ fhirResource: examplePatientSTU3,
43
+ fhirIcons: fhirIcons,
38
44
  };
39
45
 
40
- export const Example2STU3 = () => {
41
- const fhirResource = object('Resource', example2PatientSTU3);
42
- return <Patient fhirResource={fhirResource} fhirIcons={false} />;
46
+ export const Example2STU3 = Template.bind({});
47
+ Example2STU3.args = {
48
+ fhirResource: example2PatientSTU3,
49
+ fhirIcons: false,
43
50
  };
44
51
 
45
- export const Example1R4 = () => {
46
- const fhirResource = object('Resource', example1PatientR4);
47
- return <Patient fhirResource={fhirResource} fhirIcons={'random text'} />;
52
+ export const Example1R4 = Template.bind({});
53
+ Example1R4.args = {
54
+ fhirResource: example1PatientR4,
55
+ fhirIcons: 'random text',
48
56
  };
49
57
 
50
- export const Example2R4 = () => {
51
- const fhirResource = object('Resource', example2PatientR4);
52
- return <Patient fhirResource={fhirResource} />;
58
+ export const Example2R4 = Template.bind({});
59
+ Example2R4.args = {
60
+ fhirResource: example2PatientR4,
53
61
  };
54
62
 
55
- export const Example3R4 = () => {
56
- const fhirResource = object('Resource', example3PatientR4);
57
- return <Patient fhirResource={fhirResource} />;
63
+ export const Example3R4 = Template.bind({});
64
+ Example3R4.args = {
65
+ fhirResource: example3PatientR4,
58
66
  };