# @evanhongo/react-custom-component

> React component based on styled-components

Latest version **2.3.0** (published 2022-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @evanhongo/react-custom-component
pnpm add @evanhongo/react-custom-component
yarn add @evanhongo/react-custom-component
bun add @evanhongo/react-custom-component
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2022-09-03 |
| First published | 2021-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 77.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | evanhongo |
| Maintainers | evanhongo |
| Keywords | frontend, react-component, style-components |

## Links

- npm: https://www.npmjs.com/package/@evanhongo/react-custom-component
- Repository: https://github.com/evanhongo/react-custom-component
- Issues: https://github.com/evanhongo/react-custom-component/issues
- npm.io page: https://npm.io/package/@evanhongo/react-custom-component

## Dependencies (1)

- [styled-components](https://npm.io/package/styled-components.md) ^5.3.0

## Recent versions

- 2.3.0 (latest) — 2022-09-03
- 2.2.0 — 2022-08-05
- 2.1.3 — 2022-02-12
- 2.1.2 — 2021-10-30
- 2.1.1 — 2021-10-30
- 2.1.0 — 2021-10-30
- 2.0.3 — 2021-09-18
- 2.0.2 — 2021-09-10
- 2.0.1 — 2021-05-21
- 2.0.0 — 2021-05-07
- 1.5.1 — 2021-03-26
- 1.5.0 — 2021-03-14
- 1.4.4 — 2021-02-06
- 1.4.3 — 2021-01-30
- 1.4.2 — 2021-01-23
- … 9 more at https://npm.io/package/@evanhongo/react-custom-component/versions

## README

# react-custom-component

[![npm package][npm-badge]][npm]

## Components

```js
import {
  ScrollBar,
  FancyButton,
  FancyButtonGroup,
  Slider,
  Modal,
  Loader,
  Popup,
  FancyText,
  ProgressiveImg
} from '@evanhongo/react-custom-component'
```

<br />

### **ScrollBar**

|  Props   |   Type   | Description               |
| :------: | :------: | :------------------------ |
|  width   | {string} | Width of the progress bar |
| children |  {node}  | Primary content           |

<br />

### **Slider**

|  Props   |   Type   | Description                                        |
| :------: | :------: | :------------------------------------------------- |
|  isOpen  |  {bool}  | Controls whether or not the slider is displayed    |
|  width   | {string} | Width of the slider                                |
| postion  | {string} | Postion of the slider <br />Enums: **left, right** |
|  style   | {object} | Custom styles                                      |
| children |  {node}  | Primary content                                    |

<br />

### **FacncyButton, FacncyButtonGroup**

|  Props   |   Type   | Description               |
| :------: | :------: | :------------------------ |
| onClick  |  {func}  | Called after user's click |
|  style   | {object} | Custom styles             |
| children |  {node}  | Primary content           |

<br />

### **Modal**

|  Props   |   Type   | Description                                    |
| :------: | :------: | :--------------------------------------------- |
|  isOpen  |  {bool}  | Controls whether or not the Modal is displayed |
| onClose  |  {func}  | Called when a close event happens              |
|  style   | {object} | Custom styles                                  |
| children |  {node}  | Primary content                                |

### **Modal.Header, Modal.Content, Modal.Actions**

|  Props   |   Type   | Description     |
| :------: | :------: | :-------------- |
|  style   | {object} | Custom styles   |
| children |  {node}  | Primary content |

<br />

### **Loader**

| Props |   Type   | Description                                      |
| :---: | :------: | :----------------------------------------------- |
| type  | {string} | Loading style <br/> Enums: **rolling, spinning** |
| style | {object} | Custom styles                                    |

<br />

### **Dropdown**

|    Props    |   Type    | Description                                                                   |
| :---------: | :-------: | :---------------------------------------------------------------------------- |
|  multiple   |  {bool}   | A selection dropdown can allow multiple selections                            |
| placeholder | {string}  | A hint that describes the expected value of the field                         |
|   options   | {arrayOf} | Array of dropdown option props e.g. `{ key: '', text: '' }`                   |
|    value    | {arrayOf} | Current value array                                                           |
|  onChange   |  {func}   | Called when the user attempts to change the value <br/> onChange(data: array) |
|    style    | {object}  | Custom styles                                                                 |

<br />

### **Popup**

|  Props  |   Type   | Description                                                |
| :-----: | :------: | :--------------------------------------------------------- |
| content |  {node}  | Element to be rendered for the popover                     |
| trigger |  {node}  | Element to be rendered in-place where the popup is defined |
|  style  | {object} | Custom styles                                              |

<br />

### **FancyText**

| Props |   Type   | Description                                   |
| :---: | :------: | :-------------------------------------------- |
| type  | {string} | Effect style <br/> Enums: **glitch, shaking** |
| text  | {string} | Text                                          |
| style | {object} | Custom styles                                 |

<br />

### **ProgressiveImg**

| Props |   Type   | Description                                   |
| :---: | :------: | :-------------------------------------------- |
| src  | {string} | Actual image |
| placeholderSrc  | {string} | Temporary image |
| width | {string} | Width of image |
| height | {string} | Height of image |

---

## Demo

### Storybook

```
npm run storybook
```

- Demo site is hosted at http://localhost:6006

<br />

![image](./demo/gif/demo1.gif)
<br />
<br />
<br />

```js
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
  <Modal.Header style={{ fontSize: '30px' }}>Warning!!～</Modal.Header>
  <Modal.Content>
    <p style={{ fontSize: '30px' }}>Are you sure?</p>
  </Modal.Content>
  <Modal.Actions>
    <input
      type="button"
      value="No"
      style={{
        marginRight: '10px',
        width: '100px',
        height: '50px',
        fontSize: '20px',
      }}
      onClick={() => setIsOpen(false)}
    />
    <input
      type="button"
      value="Yes"
      style={{ width: '100px', height: '50px', fontSize: '20px' }}
      onClick={() => setIsOpen(false)}
    />
  </Modal.Actions>
</Modal>
```

![image](./demo/gif/demo2.gif)

<br />

```js
const [selected, setSelected] = useState([])
;<Dropdown
  options={[
    { key: 1, text: '123' },
    { key: 2, text: '234' },
    { key: 3, text: '345' },
    { key: 4, text: 'ABC' },
    { key: 5, text: 'DEF' },
    { key: 6, text: 'GHI' },
  ]}
  value={selected}
  onChange={(key) => {
    setSelected(key)
  }}
/>
```

```js
<Popup
  trigger={
    <button
      style={{
        fontSize: '30px',
        color: '#df2929',
        cursor: 'pointer',
        userSelect: 'none',
      }}
    >
      Test
    </button>
  }
  content={<div style={{ fontSize: '30px' }}>Hello World</div>}
  style={{ margin: '300px 300px' }}
/>
```

![image](./demo/gif/demo3.gif)

```js
<FancyText
  as="div"
  type="glitch"
  text="Test123456"
  style={{ fontSize: '70px' }}
/>
```

![image](./demo/gif/demo4.gif)

[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.org/package/npm-package

---
_Source: https://npm.io/package/@evanhongo/react-custom-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
