0.1.0-alpha.0 • Published 4 years ago

software-platforms-design-systems v0.1.0-alpha.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
4 years ago

PerkinElmer Component Library

This project was created to help PerkinElmer teams to provide rapid software development and a uniform approach to styling and themes. Component themse can be easily provided and individual styles overridden.

Technologies used:

Development

Testing

npm run test

or

yarn run test

Building

npm run build

or

yarn run build

Storybook

To run a live-reload Storybook server on your local machine:

npm run storybook

or

yarn run storybook

Installing the Component Library Locally

Let's say you have another project (test-app) on your machine that you want to try installing the component library into without having to first publish the component library. In the test-app directory, you can run:

npm i --save ../software-platforms-ui-components

which will install the local component library as a dependency in test-app. It'll then appear as a dependency in package.json like:

{
  ...
  "dependencies": {
    ...
    "software-platforms-ui-components": "file:../software-platforms-ui-components",
    ...
  },
  ...
}

Your components can then be imported and used in that project.

NOTE: After installing the component library locally, you may run into:

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

You might have mismatching versions of React and the renderer (such as React DOM)
You might be breaking the Rules of Hooks
You might have more than one copy of React in the same app See for tips about how to debug and fix this problem.

This is the most commonly encountered problem people face when installing the library locally. This is most likely due to the third reason: You might have more than one copy of React in the app.

Normally when a library is published, dev dependencies are excluded. However, when the library is symlinked, all local dev dependencies are persisted in the libraries node_modules (includes React). Your bundler may see two versions of React, one in the consuming app and one in the symlinked library. The solution is to have the component library use the React version in the consuming app. So from your component library folder, run:

npm link ../test-app/node_modules/react

OR, if you are using Webpack in app you can follow this GitHub comment.

Read more about this issue here.

Usage

To consume this library, run

npm i software-platforms-ui-components

or

yarn add software-platforms-ui-components

Usage of the component will be:

import React from "react";
import { Button } from "software-platforms-ui-components";

const handleClick = (event) => {
    ...
};

const App = () => (
  <div className="app-container">
    <h1>Hello I'm consuming the component library</h1>
    <Button className="primary" onClick={handleClick}>
      Click me
    </Button>
  </div>
);

export default App;
0.1.0-alpha.0

4 years ago

0.0.2-SNAPSHOT

4 years ago

0.0.1-SNAPSHOT

4 years ago