plasma-fhir
  • What is Plasma FHIR?
  • Docs
    • Guides
      • Getting Started
      • Create an Epic Patient App
      • Create an Epic Clinician App
      • Create an Epic Backend App
      • Testing with SMART Health IT Sandbox
      • Developing/Contributing to Plasma FHIR
  • Packages
    • create-plasma-app
    • plasma-fhir-app-utils
      • PlasmaFHIRApi
      • Resources
      • PlasmaFHIRUtils
      • Conversions
      • DateTimeUtils
    • plasma-fhir-backend-utils
    • plasma-fhir-react-client-context
    • plasma-fhir-react-components
  • Sample Apps
    • Plasma Portal
    • Plasma Portal Lite
    • Family History Editor
    • Playground
Powered by GitBook
On this page
  • Demo (Storybook)
  • Usage
  • Styling
  • Testing/Development (of Package)
  • Storybook
  • Unit Tests
  • Install/Update Locally
  • Deployment (of Package)
  • Rollup
  • Publish/Deploy
  • References:
  1. Packages

plasma-fhir-react-components

Previousplasma-fhir-react-client-contextNextPlasma Portal

Last updated 2 years ago

This package is a set of React components for displaying FHIR resources (mostly R4, but there are a few DSTU2 components). The components bind directly to FHIR resources.

Out of the box, components are not styled. The styles can and should be customized using CSS. The components are merely to provide logic and structure to components. It is up to you (the developer) to style them in a way that matches your application.

Demo (Storybook)

Check out our Storybook project to see a demo of each component.

Usage

Import the components and use them in your application. They should take a FHIR resource as a prop.

import { FHIRr4 } from "plasma-fhir-react-components";

export function MyComponent(props: any) {
    return (
        <FHIRr4.AllergyIntoleranceView allergyIntolerance={...} />
    );
}

Styling

  • Each component has a unique CSS class name(s). You can specify the styles for these classes in your own custom CSS file.

  • If you are using SASS along with another CSS library, you can use the @apply operator to add classes directly

  • Use "Inspect Element" in the browser to determine the class names of each component.

.CodingSelector {
    @apply capitalize;
}

Testing/Development (of Package)

Storybook

  • yarn storybook

  • yarn build-storybook

Unit Tests

  • yarn test

Install/Update Locally

  • In your app:

    • npm install --save ../../packages/plasma-fhir-react-components

  • After making changes:

    • This package: yarn rollup

    • Your app: npm install --save ../../packages/plasma-fhir-react-components

Deployment (of Package)

When deploying, please rollup and publish new version to NPM

Rollup

  • yarn rollup

Publish/Deploy

  • Increment version

  • yarn rollup

  • yarn storybook (make sure everything looks ok)

  • npm publish

  • yarn build-storybook

  • Publish the static files to plasmafhir.com/plasma-fhir-react-components

References:

https://plasmafhir.com/plasma-fhir-react-components
https://dev.to/alexeagleson/how-to-create-and-publish-a-react-component-library-2oe