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

@project-r/styleguide

v14.0.3

Published

This is a living style guide. Subject to constant change.

Downloads

827

Readme

This is a living style guide. Subject to constant change.

It documents the current state and provides implemented React components, published as an npm package.

About

The development started on March 5th 2017 for the crowdfunding of republik.ch. It has since been continuously expanded and now provides a wide range of functionality from colors and typography definitions, to an video player, common form elements, discussion trees, a full suite of editorial elements—from teasers to infoboxes, template definitions targeting web and email and a charting system.

It's currently primarly used to power our web and cms frontends—republik-frontend and publikator-frontend.

Beyond that it provides some definitions to our backends and app, was used in various prototypes and the charts are available on observablehq.com for story prototyping.

License

The logo and fonts are the property of their owners (logo—Project R, GT America—GrilliType and Rubis—Nootype), and may not be reproduced without permission.

The source code is «BSD 3-clause» licensed.

Use it in your React app

The peer dependencies are: react, prop-types and glamor.

npm install @project-r/styleguide --save

Example button:

import {Button} from '@project-r/styleguide'

const Crowdfunding = () => (
  <section>
    <p>«Es ist Zeit, dass sich die Journalisten unabhängig machen und der Journalismus unabhängig von den Grossverlagen existieren kann. Und ein Modell dafür schafft man nur gemeinsam, oder gar nicht.»</p>
    <Button>Mitmachen</Button>
  </section>
)

See components in the menu for a full list and documentation.

Usage with Next.js

glamor needs to be integrated into server rendering. For a simple integration use the following pages/_document.js:

import Document, {Head, Main, NextScript} from 'next/document'
import {renderStatic} from 'glamor/server'

export default class MyDocument extends Document {
  static async getInitialProps ({renderPage}) {
    const page = renderPage()
    const styles = renderStatic(() => page.html)
    return { ...page, ...styles }
  }
  render () {
    const {css} = this.props
    return (
      <html>
        <Head>
          <meta name='viewport' content='width=device-width,initial-scale=1' />
          <meta httpEquiv='X-UA-Compatible' content='IE=edge' />
          {css ? <style dangerouslySetInnerHTML={{ __html: css }} /> : null}
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </html>
    )
  }
}

See also:

Theming

We want to keep the style guide code simple and will keep the theming options to a minimum. Fork if you want to customize more.

Following environment variables are available for theming:

SG_COLORS={"primary":"Maroon"}
SG_FONT_STYLES={"serifRegular":{"fontFamily":"'Merriweather', serif"},"serifTitle":{"fontFamily":"'Merriweather', serif","fontWeight":900}}
SG_FONT_FACES=@import url('https://fonts.googleapis.com/css?family=Merriweather:400,900&display=swap')
SG_LOGO_PATH=M0 0 L4 0 L4 1.5 L3 0.5 L2 4 L1 0.5 L0 1.5 Z
SG_LOGO_VIEWBOX=0 0 4 1.5
SG_LOGO_GRADIENT=<linearGradient id="logo-gradient"></linearGradient>
SG_BRAND_MARK_PATH=M0 4 L1 0 L4 4 Z
SG_BRAND_MARK_VIEWBOX=0 0 4 4

They may be prefixed with REACT_APP_ for CRA compatibility. And will be retrieved from window.ENV, window.__NEXT_DATA__.env or process.env.

Develop

This style guide is build with Catalog. You can write documentation in Markdown and React.

You will need Node.js 14 or higher.

To start the development server run:

npm install
npm run dev

Further reading:

Semantic Release

The master branch gets auto-released via Travis. The next version is automatically determined according to the past commit messages.

Commit Message Format

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

You can use npm run commit to generate a message via an interactive prompt.

Types

Always changelog relevant: feat, fix, perf Others: docs, chore, style, refactor, test

Scope is optional.

The body should include the motivation for the change and contrast this with previous behavior.

The footer should contain any information about Breaking Changes and is also the place to reference GitHub issues that this commit Closes.

Quick Examples

Patch Release

fix(field): focus issue in IE

Closes #28

Feature Release

feat(field): add auto focus option

Breaking Release

refactor(field): remove label support

BREAKING CHANGE: We no longer support field labels only placeholders!