# react-reusable-components-library

> A reusable React component library with extensively used components to develop a webpage/lib

Latest version **1.0.2** (published 2019-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-reusable-components-library
pnpm add react-reusable-components-library
yarn add react-reusable-components-library
bun add react-reusable-components-library
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-06-11 |
| First published | 2019-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 44.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | sonalojha |
| Keywords | react, react-components, react-reusable-components, input, button, button-group, components |

## Links

- npm: https://www.npmjs.com/package/react-reusable-components-library
- npm.io page: https://npm.io/package/react-reusable-components-library

## Dependencies (7)

- [@babel/core](https://npm.io/package/@babel/core.md) 7.4.4
- [@emotion/core](https://npm.io/package/@emotion/core.md) 10.0.10
- [@emotion/styled](https://npm.io/package/@emotion/styled.md) 10.0.12
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) 7.4.4
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) 7.0.0
- [@babel/preset-stage-0](https://npm.io/package/@babel/preset-stage-0.md) 7.0.0
- [@babel/plugin-proposal-class-properties](https://npm.io/package/@babel/plugin-proposal-class-properties.md) 7.4.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-06-11
- 0.0.1 — 2019-06-11

## README

# react-reusable-components-library

-  Examples on Git repo : https://github.com/sonal-ojha/examples-React-reusable-components

react-reusable-components-library is simple to use yet customizable component library which can be used to develop a webpage.
  - The library consists of Inputbox, Button and Grouped Buttons components as of now.
  - All the components are extensively customizable by passing various set of props.
  - Library uses the customStyle prop and overrides the default styles to the elements.
  - `customStyle` as a prop which includes styles in a object format.
  Example: 
    customStyle={{
        margin: '20px',
        width: '200px',
        'background-color': '#ccc',
        'padding-top': '5px',
    }}

  - disabled: As a prop can be passed to Button component.
  - primaryBgColor: overrides the default primary background color. This can be used in both Button and ButtonGroup components.
  - buttonList: This prop is an array of objects used by ButtonGroup component. Each object should consist of [key, value and style] properties. key represents the ID, value represents the title to be displayed on the button and style specific to button. 
  - primaryBgColor highlights the selected button from the group.
  - buttonClicked: Callback that is triggered on click of button and accepts 2 parameters (value, key).
  - selectedValue: represents the current selected option from group of buttons.

  - InputBox: This component accepts 'id, inputText(user entered text), customStyle(overrides styles), inputValue(callback triggers on OnChnage event handler).
  - errorMessage: This prop helps in displaying the error messages at validation level. A props which accepts string and displays error message relative to the input field.

### Installation

This requires [React.js and Prop-Types] to run.
```sh
npm i react-reusable-components-library
```

### How to Use

Install and import react-reusable-components-library and pass the props as per the below table

```sh
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import ReactComponentLibrary from 'react-reusable-components-library';

class App extends Component {

    state = {
    text: '',
    selectedValue: 'one',
    buttonList: [
      {
        key: '1',
        value: 'one',
        style: {
          color: 'red',
          'font-weight': 'bold',
        }
      },
      {
        key: '2',
        value: 'Two',
        style: {
          color: 'yellow',
          'font-weight': 'bold',
        }
      },
    ]
  }

  handleButtonGroupClick = (value, key) => {
    this.setState({
      selectedValue: value
    })
  }

  handleChange = (value, key) => {
    this.setState({
      text: value
    })
  }

  render() {
    return (
      <div className="App">
        <ReactComponentLibrary.Button 
          title="Customizable Button"
          id="1"
          buttonClick={this.buttonClicked}
          primaryBgColor='green'
          customStyle={{
            margin: '20px',
            width: '200px',
          }}
          disabled
        />
        <ReactComponentLibrary.ButtonGroup
          buttonList={buttonList}
          selectedValue={selectedValue}
          buttonClicked={this.handleButtonGroupClick}
          primaryBgColor="green"
          customStyle={{
            'font-size': '15px',
          }}
        />
        <ReactComponentLibrary.Input
          id="2"
          inputValue={this.handleErrorInput}
          inputText={text}
          customStyle={{
            margin: '20px',
          }}
          errorMessage='Please Enter Value!!!'
        />
      </div>
    );
  }
}

export default App;

```
### Work In Progress - On other components.
```

## Contribution

You are welcome to raise issues and PRs in the repository

---
_Source: https://npm.io/package/react-reusable-components-library · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
