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

origin-storybook

v0.11.0

Published

Component library for Origin Protocol, using Storybook

Downloads

14

Readme

Origin Protocol Component Library

An Origin Protocol shared component library, using React, Storybook.js, and rollup.js.

Install and use components

These components are meant to be used by originprotocol.com, ousd.com, and story.xyz React frontend apps.

To use in a consuming React app

  1. Install the npm package.
npm install origin-storybook

In a React component, import components:

import { Card, Header, Footer } from 'origin-storybook'
...
<Header webProperty='originprotocol' />

<Card 
  webProperty='originprotocol'
  title="Lucky Ducky NFTs"
  imgSrc="https://placekeanu.com/510/340"
  imgAlt="keanu banner"
  body="7,777 Lucky Duckies have left the pond and are getting into mischief!"
  linkText="Visit luckyducky.xyz/market"
  linkHref="https://google.com"
  thumbnailSrc="https://placekeanu.com/128/128"
  thumbnailAlt="Keanu face"
/>

<Footer />
...

Running and developing Storybook locally

To run storybook locally to develop or look at component docs, install and run Storybook:

yarn
yarn storybook

This will stand up a Storybook server at localhost:6006.


Making new components

  1. In src/components, add a folder with your component name and an index.tsx file.
export const YourComponent = () => {
  ...
}
  1. Add a YourComponent.stories.tsx file in your folder.
import { ComponentStory, ComponentMeta } from '@storybook/react';

import { YourComponent } from '.';

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
  title: 'Origin/YourComponent',
  component: Footer,
  // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
  argTypes: {
    backgroundColor: { control: 'color' },
  },
} as ComponentMeta<typeof Footer>;

// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof YourComponent> = (args) => (
  <YourComponent />
)

export const YourComponentStoryTitle = Template.bind({});

Your folder should look like:

.
└── src/
    └── components/
        └── YourComponent/
            ├── index.tsx
            └── YourComponent.stories.tsx
  1. In src/index.ts, import your component:
import './index.css'

export * from './components/Button'
export * from './components/Card'
export * from './components/Dropdown'
export * from './components/Footer'
export * from './components/Header'
export * from './components/Typography'
export * from './components/YourComponent' // add your component here

Development notes

  • We use Tailwindcss v2 for styling
  • We use HeadlessUI for more complex UI interactions like dropdowns.
  • The build step will compile image and CSS styling, so consuming apps don't need to have Tailwind or HeadlessUI installed.

Publishing updates

Building changes

Once the preview of the components with changes look good, you'll want to build the components using Rollup.

yarn build

Publishing changes

After commiting changes:

yarn build
npm version [major|minor|patch] -m "New version message"
npm publish