0.1.0 • Published 3 years ago

mini-hmi v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

mini-hmi

React component library to build Human-machine interface\ Storybook demos

Installing

npm i mini-hmi

Usage

You need to wrap mini-hmi components with Diagram:

import { Diagram, Switch, Sensor } from 'mini-hmi';

<Diagram backgroundImage="path/to/background.img" width={1920} height={1080}>
  <Switch className="my-switch" state={false} x={440} y={545} width={10} />
  <Sensor className="my-sensor" value={0.34} x={660} y={320} width={100} height={20} format="0%" />
</Diagram>;

Available components

Diagram

Root component to display other components\ Shows background image you provide and aligns nested components

Props:

PropDescriptionTypeRequired
backgroundImageImage url to be used as a backgroundstring
widthOriginal background image width (in pixels)number
heightOriginal background image height (in pixels)number
classNameCustom class name to be attachedstring

Switch

Displays boolean values\ Supports 3 states: on, off and not available

Props:

PropDescriptionTypeRequired
stateState to displayboolean | undefined
xX position (in pixels)number
yY position (in pixels)number
widthWidth (in pixels)number
heightHeight (in pixels)number
enabledColorenabled colorstring
disabledColordisabled colorstring
notAvailableColorN/A colorstring
classNameCustom class name to be attachedstring

Sensor

Displays numeric values with optional format\ See numerable format options

Props:

PropDescriptionTypeRequired
valueState to displaynumber | string | null | undefined
xX position (in pixels)number
yY position (in pixels)number
widthWidth (in pixels)number
heightHeight (in pixels)number
formatFormat for value See numerable formatsstring | null | undefined
formatOptionsFormat options for valueSee numerable format optionsstring
classNameCustom class name to be attachedstring

Customization

You can provide className prop to any component to display custom styles