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

@catastrophee/ui

v0.0.3

Published

Common UI Components

Downloads

5

Readme

@catastrophee/ui

@catastrophee/ui is a set of React components. These componenets are currently in beta. Use at your own risk

Using @catastrophee/ui

Install

Installing uicommon on your project

npm install --save @catastrophee/ui

or

yarn add @catastrophee/ui

Import

import { Checkbox } from '@catastrophee/ui';

Use

<Checkbox ...props />

Each component has its own README, please refer to those for more information.

Need to overwrite styles?

Ideally, you shouldn't need to overwrite styles. But if you must, each component takes a prop called style. The style prop is typed. To know the key you need to use to replace the style, right click on your component and look for data-style attribute on the html tag. For instance, if data-style="list" you can replace the background color with: <Component style={{ list: { backgroundColor: "green"}}}>

Developing

Storybook

To run examples: From project root folder:

yarn install
yarn run storybook

Note Stories are availables in the files with .stories extensions

Rules for Styling Components

  • For styling, use glamor.

  • Always sort your keys.

  • Always put styles in the same file. Usually right after imports, on top. Please don't create one file for style and one file for component. Each component should be one file, easy to use. Default styles should be called defaultStyles.

  • Always allow style overwrites. For instance, each component should start with const styles = merge({}, defaultStyles, style); and components should always take a style prop.

  • Every HTML tag should contain a data-style attribute with the key for that style. If the style has no styles, still create the key but leave it empty

  • For all styles add proper typing. For instance, let say your component looks like this:

    <div>
      <span>{title}</span>
    </div>

    Once you add styles it should look like this

    const defaultStyles = {
      container: {},
      title: {},
    };
    ....
    
    <div {...css(defaultStyles.container)}>
      <span {...css(defaultStyles.title)}>{title}</span>
    </div>

    Once you allow overwrite styles it should look like this

    const defaultStyles = {
      container: {},
      title: {},
    };
    
    const styles = merge({}, defaultStyles, props.style);
    render() {
      <div {...css(styles.container)}>
        <span {...css(styles.title)}>{title}</span>
      </div>
    }

Let people know how to overwrite styles

const defaultStyles = {
  container: {},
  title: {},
};
interface StylesType {
  container: CssPropertyType,
  title: CssPropertyType,
}
....
const styles = merge({}, defaultStyles, props.style);
render() {
  <div {...css(styles.container)} data-style="container">
    <span {...css(styles.title)} data-style="title">{title}</span>
  </div>
}

Please take a look at existing components for examples

Publishing @catastrophee/ui

@catastrophee/ui

cd packagaes/ui
yarn install
yarn publish