npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evanhongo/react-custom-component

v2.3.0

Published

React component based on styled-components

Downloads

32

Readme

react-custom-component

npm package

Components

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

ScrollBar

| Props | Type | Description | | :------: | :------: | :------------------------ | | width | {string} | Width of the progress bar | | children | {node} | Primary content |

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 Enums: left, right | | style | {object} | Custom styles | | children | {node} | Primary content |

FacncyButton, FacncyButtonGroup

| Props | Type | Description | | :------: | :------: | :------------------------ | | onClick | {func} | Called after user's click | | style | {object} | Custom styles | | children | {node} | Primary content |

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 |

Loader

| Props | Type | Description | | :---: | :------: | :----------------------------------------------- | | type | {string} | Loading style Enums: rolling, spinning | | style | {object} | Custom styles |

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

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 |

FancyText

| Props | Type | Description | | :---: | :------: | :-------------------------------------------- | | type | {string} | Effect style Enums: glitch, shaking | | text | {string} | Text | | style | {object} | Custom styles |

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

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