0.27.22 • Published 9 months ago

@originprotocol/origin-storybook v0.27.22

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Origin Protocol Component Library

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

The latest Storybook version from the main branch is live here.

Install and use components

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

To use in a consuming React app

  1. Install the npm package.
yarn add @originprotocol/origin-storybook

In a React component, import components:

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

<Card
 body="7,777 Lucky Duckies have left the pond and are getting into mischief!"
 img={<value alt="keanu banner" height="200" src="https://placekeanu.com/381/192" width="400"/>}
 linkHref="https://google.com"
 linkText="Visit luckyducky.xyz/market"
 thumbnail={<value alt="keanu face" layout="fill" src="https://placekeanu.com/128/128"/>}
 title="Lucky Ducky NFTs"
 webProperty="originprotocol"
/>

<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 v3 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

Make sure to also add the tags to Github as well!

git push origin main --tags
0.27.22

9 months ago

0.27.21

9 months ago

0.27.20

9 months ago

0.27.19

9 months ago

0.27.18

9 months ago

0.27.17

9 months ago

0.27.16

9 months ago

0.27.15

9 months ago

0.27.14

9 months ago

0.27.13

1 year ago

0.27.12

1 year ago

0.27.11

1 year ago

0.27.10

1 year ago

0.27.9

1 year ago

0.27.8

1 year ago

0.27.7

1 year ago

0.27.6

1 year ago

0.27.5

1 year ago

0.27.4

1 year ago

0.27.2

1 year ago

0.27.1

1 year ago

0.27.3

1 year ago

0.25.11

1 year ago

0.25.12

1 year ago

0.27.0

1 year ago

0.26.2

1 year ago

0.26.1

1 year ago

0.26.0

1 year ago

0.25.10

1 year ago

0.25.3

1 year ago

0.25.2

1 year ago

0.25.1

1 year ago

0.23.3

1 year ago

0.25.0

1 year ago

0.23.2

1 year ago

0.23.1

1 year ago

0.23.0

1 year ago

0.25.9

1 year ago

0.25.8

1 year ago

0.25.7

1 year ago

0.25.6

1 year ago

0.25.5

1 year ago

0.24.5

1 year ago

0.22.7

2 years ago

0.24.4

1 year ago

0.22.6

2 years ago

0.24.3

1 year ago

0.24.2

1 year ago

0.24.1

1 year ago

0.24.0

1 year ago

0.22.9

1 year ago

0.22.8

1 year ago

0.22.5

2 years ago

0.22.4

2 years ago

0.22.3

2 years ago

0.22.2

2 years ago

0.22.1

2 years ago

0.22.0

2 years ago

0.21.1

2 years ago

0.21.0

2 years ago

0.20.0

2 years ago

0.19.19

2 years ago

0.19.18

2 years ago

0.19.17

2 years ago

0.19.16

2 years ago

0.19.15

2 years ago

0.19.14

2 years ago

0.19.13

2 years ago

0.19.12

2 years ago

0.19.11

2 years ago

0.19.10

2 years ago

0.19.9

2 years ago

0.19.7

2 years ago

0.19.6

2 years ago

0.19.5

2 years ago

0.19.4

2 years ago

0.19.3

2 years ago

0.19.2

2 years ago

0.19.1

2 years ago

0.19.0

2 years ago

0.18.2

2 years ago

0.18.1

2 years ago

0.18.0

2 years ago

0.17.0

2 years ago

0.16.3

2 years ago

0.16.2

2 years ago

0.16.1

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.14.1

2 years ago

0.14.0

2 years ago

0.13.2

2 years ago

0.13.1

2 years ago

0.13.0

2 years ago

0.12.6

2 years ago

0.12.5

2 years ago

0.12.4

2 years ago

0.12.3

2 years ago

0.12.2

2 years ago

0.12.1

2 years ago

0.12.0

2 years ago

0.11.7

2 years ago

0.11.6

2 years ago

0.11.5

2 years ago

0.11.4

2 years ago

0.11.3

2 years ago

0.11.2

2 years ago

0.11.1

2 years ago

0.1.0

2 years ago