@eway-crm/guideprecated

Common React components used across eWay-CRM web projects.

Usage no npm install needed!

<script type="module">
  import ewayCrmGui from 'https://cdn.skypack.dev/@eway-crm/gui';
</script>

README

eWay-CRM Logo

eWay-CRM Component Library

Library for sharing reusable React components across projects.

Installation

The simpliest way to start using this library is to install it via npm. To do that, just run this command in your NodeJS project's root dir:

npm i @eway-crm/js-gui

This library has some peer dependencies. You can install them all at once with @eway-crm/js-gui by using this command.

npm i @eway-crm/js-gui @fluentui/react react-localization

To get the best dev experience, we also recommend using TypeScript since this library contains the types headers.

Usage

You can use any reusable component by importing it from package:

import React from "react";
import { ErrorMessage } from "@eway-crm/gui";
import { initializeIcons } from "@fluentui/react";

// Initialize icons from Fluent UI, usually at src/index.js or App.js
initializeIcons();

export default function App() {
  return (
    <ErrorMessage icon="error" techData={["There was an error while calling an external API"]}>
        Oops! An error occured.
    </ErrorMessage>
  );
}

Development

⚠ React Error: Invalid Hook Call

If you are developing this library locally and seeing Invalid Hook Call Warning from React, you have to install this libraries instance of React inside your target apps by:

npm install '…/path-to-local-js-gui-library/node_modules/react'

This will create a record in package.json:

"react": "file:../path-to-local-js-gui-library/node_modules/react"

Alternatively, you can put the line above into the package.json directly and then run npm install.

For more infromation, please see this issue: https://github.com/facebook/react/issues/13991#issuecomment-463376537

Note: Published library works without this obstruction.