2.3.0 • Published 2 years ago

@evanhongo/react-custom-component v2.3.0

Weekly downloads
20
License
MIT
Repository
github
Last release
2 years ago

react-custom-component

npm package

Components

import {
  ScrollBar,
  FancyButton,
  FancyButtonGroup,
  Slider,
  Modal,
  Loader,
  Popup,
  FancyText,
  ProgressiveImg
} from '@evanhongo/react-custom-component'

ScrollBar

PropsTypeDescription
width{string}Width of the progress bar
children{node}Primary content

Slider

PropsTypeDescription
isOpen{bool}Controls whether or not the slider is displayed
width{string}Width of the slider
postion{string}Postion of the slider Enums: left, right
style{object}Custom styles
children{node}Primary content

FacncyButton, FacncyButtonGroup

PropsTypeDescription
onClick{func}Called after user's click
style{object}Custom styles
children{node}Primary content

Modal

PropsTypeDescription
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

PropsTypeDescription
style{object}Custom styles
children{node}Primary content

Loader

PropsTypeDescription
type{string}Loading style Enums: rolling, spinning
style{object}Custom styles

Dropdown

PropsTypeDescription
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 onChange(data: array)
style{object}Custom styles

Popup

PropsTypeDescription
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

FancyText

PropsTypeDescription
type{string}Effect style Enums: glitch, shaking
text{string}Text
style{object}Custom styles

ProgressiveImg

PropsTypeDescription
src{string}Actual image
placeholderSrc{string}Temporary image
width{string}Width of image
height{string}Height of image

Demo

Storybook

npm run storybook

image

<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

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)
  }}
/>
<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

<FancyText
  as="div"
  type="glitch"
  text="Test123456"
  style={{ fontSize: '70px' }}
/>

image

2.3.0

2 years ago

2.2.0

2 years ago

2.1.3

2 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.3.3

3 years ago

1.4.1

3 years ago

1.3.2

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago