Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-parade

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-parade

Lightweight UI component stories and documentation showcase for [Next.js](https://nextjs.org/).

  • 0.0.5
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

🚩 Parade!

Lightweight UI component stories and documentation showcase for Next.js.

⚠️ Pre-alpha: This is a proof-of-concept. You will be disappointed!

Usage

npm install next-parade
yarn add next-parade

Configure and render it on a page:

// ./pages/index.js
import parade from 'next-parade'
import withStaticProps from 'next-parade/props'

const context = require.context('../src/components', true, /\.js/) // relative path and regex
export default parade(context)
export const getStaticProps = withStaticProps(context, 'src/components') // context and "absolute" path

By convention React Component should be the default export from a file.

Prior art

  • Storybook - runs on top of 'create-react-app'
  • Docz - runs on Gatsby. It's where I copied lib/docgen from
  • Styleguidist - looks slim and promising. I did not have the opportunity use it nor to dive in it's code yet.

Idea behind this project is to prove that something simillar can be done running on Next.js

Advanced example

// ./pages/showcase.tsx
import { GetStaticProps } from 'next'
import parade from 'next-parade'
import withStaticProps from 'next-parade/props'
import styles from '../styles/Home.module.css'

const context = require.context('../components', true, /\/[A-Z]\w\.tsx/)
const ComponentsParade = parade(context)

const Home = ({ ...props }) => (
  <div className={styles.container}>
    <ComponentsParade {...props} title="Styleguide" style={{ maxWidth: '600px' }} />
  </div>
)

export default Home

export const getStaticProps: GetStaticProps = async (context) => {
  const output = withStaticProps(context, 'components')
  return {
    ...output,
    props: {
      ...output.props,
      // additional props and overrides
    },
  }
}

Development

npm run dev
yarn dev

Open http://localhost:3000 with your browser to see the result.

This project is using itself for creating it's documentation.

Roadmap

  • automate CI
  • live edit props
  • parse markdown
  • order of elements (sort)
  • add "last build" to website

FAQs

Package last updated on 30 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc