0.4.0 • Published 1 year ago

@hophiphip/react-fishbone v0.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

React Fishbone

React fishbone (Ishikawa) diagram component.

Installation

npm i @hophiphip/react-fishbone

Usage

Import the component

import Fishbone from '@hophiphip/react-fishbone';

Component usage example

<Fishbone 
    items={{
        "name": "Flaws",
        "children": [
            {
                "name": "Machines",
                "children": [
                    {"name": "Speed"},
                    {"name": "Bits"},
                    {"name": "Sockets"}
                ]
            }
        ]
    }}
    wrapperStyle={{ 
        width: 1000, 
        height: 500,
    }}
/>

API

FishboneNode

Fishbone diagram node.

PropertyTypeDescription
namestringText content
childrenFishboneNode[], undefinedNested children

LineConfig

Fishbone line/link parameters for specific level of nesting

PropertyTypeDescription
colorstringLine color
strokeWidthPxnumberLine width in px

NodeConfig

Fishbone node parameters for specific level of nesting

PropertyTypeDescription
colorstringText color
fontSizeEmnumberText size in em

FishboneProps

Fishbone component props.

PropertyTypeDescription
widthstring, number, undefinedComponent width
heightstring, number, undefinedComponent height
itemsFishboneNode, undefinedComponent node items
linesConfigLineConfig[], undefinedComponent line config for each level of nesting
nodesConfigNodeConfig[], undefinedComponent node items for each level of nesting
wrapperStyleReact.CSSProperties, undefinedComponent wrapper <div /> style

Storybook

Building/Running storybook might cause an error

Error: error:0308010C:digital envelope routines::unsupported

That error appears in NodeJS versions > 16. Temporary solution is to set NODE_OPTIONS to --openssl-legacy-provider

cross-env NODE_OPTIONS=--openssl-legacy-provider npm run storybook
cross-env NODE_OPTIONS=--openssl-legacy-provider npm run build-storybook
0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.0

2 years ago