@project-r/styleguide
TypeScript icon, indicating that this package has built-in type declarations

14.0.3 • Public • Published

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!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
14.0.334latest

Version History

VersionDownloads (Last 7 Days)Published
14.0.334
14.0.20
14.0.10
14.0.00
13.11.00
13.10.00
13.9.30
13.9.20
13.9.10
13.9.00
13.8.00
13.7.30
13.7.20
13.7.10
13.7.00
13.6.40
13.6.30
13.6.20
13.6.10
13.6.00
13.5.11
13.5.00
13.4.00
13.3.20
13.3.10
13.3.00
13.2.20
13.2.10
13.2.00
13.1.10
13.1.00
13.0.40
13.0.30
13.0.20
13.0.10
13.0.00
12.10.10
12.10.00
12.9.00
12.8.00
12.7.00
12.6.00
12.5.00
12.4.10
12.4.00
12.3.00
12.2.10
12.2.00
12.1.10
12.1.00
12.0.120
12.0.110
12.0.100
12.0.90
12.0.80
12.0.70
12.0.60
12.0.50
12.0.40
12.0.30
12.0.20
12.0.10
12.0.00
11.16.00
11.15.00
11.14.00
11.13.00
11.12.20
11.12.10
11.12.00
11.11.10
11.11.00
11.10.00
11.9.00
11.8.20
11.8.10
11.8.00
11.7.00
11.6.00
11.5.20
11.5.10
11.5.00
11.4.30
11.4.20
11.4.10
11.4.00
11.3.00
11.2.10
11.2.00
11.1.20
11.1.10
11.1.00
11.0.00
10.18.60
10.18.50
10.18.40
10.18.30
10.18.20
10.18.10
10.18.00
10.17.20
10.17.10
10.17.00
10.16.10
10.16.00
10.15.20
10.15.10
10.15.00
10.14.30
10.14.20
10.14.10
10.14.00
10.13.00
10.12.00
10.11.30
10.11.20
10.11.10
10.11.00
10.10.00
10.9.00
10.8.10
10.8.00
10.7.10
10.7.00
10.6.00
10.5.30
10.5.20
10.5.10
10.5.00
10.4.10
10.4.00
10.3.10
10.3.00
10.2.00
10.1.10
10.1.00
10.0.70
10.0.60
10.0.50
10.0.40
10.0.30
10.0.20
10.0.10
10.0.00
9.36.00
9.35.10
9.35.00
9.34.10
9.34.00
9.33.30
9.33.20
9.33.10
9.33.00
9.32.00
9.31.40
9.31.30
9.31.20
9.31.10
9.31.00
9.30.10
9.30.00
9.29.00
9.28.00
9.27.00
9.26.10
9.26.00
9.25.00
9.24.00
9.23.00
9.22.00
9.21.10
9.21.00
9.20.00
9.19.70
9.19.60
9.19.50
9.19.40
9.19.30
9.19.20
9.19.10
9.19.00
9.18.00
9.17.40
9.17.30
9.17.20
9.17.10
9.17.00
9.16.00
9.15.10
9.15.00
9.14.60
9.14.50
9.14.40
9.14.30
9.14.20
9.14.10
9.14.00
9.13.00
9.12.20
9.12.10
9.12.00
9.11.00
9.10.00
9.9.00
9.8.10
9.8.00
9.7.00
9.6.20
9.6.10
9.6.00
9.5.40
9.5.30
9.5.20
9.5.10
9.5.00
9.4.00
9.3.10
9.3.00
9.2.00
9.1.30
9.1.20
9.1.10
9.1.00
9.0.20
9.0.10
9.0.00
8.29.10
8.29.00
8.28.90
8.28.80
8.28.70
8.28.60
8.28.50
8.28.40
8.28.30
8.28.20
8.28.10
8.28.00
8.27.10
8.27.00
8.26.00
8.25.00
8.24.00
8.23.00
8.22.00
8.21.00
8.20.00
8.19.00
8.18.00
8.17.10
8.17.00
8.16.10
8.16.00
8.15.00
8.14.10
8.14.00
8.13.00
8.12.00
8.11.10
8.11.00
8.10.00
8.9.20
8.9.10
8.9.00
8.8.10
8.8.00
8.7.00
8.6.10
8.6.00
8.5.30
8.5.20
8.5.10
8.5.00
8.4.10
8.4.00
8.3.00
8.2.40
8.2.30
8.2.20
8.2.10
8.2.00
8.1.00
8.0.30
8.0.20
8.0.10
8.0.00
7.12.00
7.11.10
7.11.00
7.10.20
7.10.10
7.10.00
7.9.00
7.8.10
7.8.00
7.7.00
7.6.10
7.6.00
7.5.00
7.4.00
7.3.00
7.2.00
7.1.00
7.0.00
6.35.00
6.34.00
6.33.00
6.32.00
6.31.20
6.31.10
6.31.00
6.30.10
6.30.00
6.29.10
6.29.00
6.28.10
6.28.00
6.27.00
6.26.20
6.26.10
6.26.00
6.25.50
6.25.40
6.25.30
6.25.20
6.25.10
6.25.00
6.24.00
6.23.00
6.22.20
6.22.10
6.22.00
6.21.00
6.20.10
6.20.00
6.19.00
6.18.00
6.17.40
6.17.30
6.17.20
6.17.10
6.17.00
6.16.10
6.16.00
6.15.00
6.14.00
6.13.00
6.12.10
6.12.00
6.11.50
6.11.40
6.11.30
6.11.20
6.11.10
6.11.00
6.10.00
6.9.00
6.8.30
6.8.20
6.8.10
6.8.00
6.7.00
6.6.30
6.6.20
6.6.10
6.6.00
6.5.00
6.4.00
6.3.00
6.2.10
6.2.00
6.1.00
6.0.00
5.95.00
5.94.00
5.93.50
5.93.40
5.93.30
5.93.20
5.93.10
5.93.00
5.92.50
5.92.40
5.92.30
5.92.20
5.92.10
5.92.00
5.91.00
5.90.00
5.89.00
5.88.30
5.88.20
5.88.10
5.88.00
5.87.00
5.86.20
5.86.10
5.86.00
5.85.00
5.84.00
5.83.20
5.83.10
5.83.00
5.82.20
5.82.10
5.82.00
5.81.70
5.81.60
5.81.50
5.81.40
5.81.30
5.81.20
5.81.10
5.81.00
5.80.10
5.80.00
5.79.00
5.78.20
5.78.10
5.78.00
5.77.30
5.77.20
5.77.10
5.77.00
5.76.10
5.76.00
5.75.10
5.75.00
5.74.20
5.74.10
5.74.00
5.73.10
5.73.00
5.72.30
5.72.20
5.72.10
5.72.00
5.71.80
5.71.70
5.71.60
5.71.50
5.71.40
5.71.30
5.71.20
5.71.10
5.71.00
5.70.60
5.70.50
5.70.40
5.70.30
5.70.20
5.70.10
5.70.00
5.69.20
5.69.10
5.69.00
5.68.10
5.68.00
5.67.00
5.66.10
5.66.00
5.65.00
5.64.30
5.64.20
5.64.10
5.64.00
5.63.70
5.63.60
5.63.50
5.63.40
5.63.30
5.63.20
5.63.10
5.63.00
5.62.20
5.62.10
5.62.00
5.61.40
5.61.30
5.61.20
5.61.10
5.61.00
5.60.40
5.60.30
5.60.20
5.60.10
5.60.00
5.59.00
5.58.20
5.58.10
5.58.00
5.57.00
5.56.00
5.55.50
5.55.40
5.55.30
5.55.20
5.55.10
5.55.00
5.54.20
5.54.10
5.54.00
5.53.10
5.53.00
5.52.10
5.52.00
5.51.00
5.50.90
5.50.80
5.50.70
5.50.60
5.50.50
5.50.40
5.50.30
5.50.20
5.50.10
5.50.00
5.49.00
5.48.10
5.48.00
5.47.10
5.47.00
5.46.20
5.46.10
5.46.00
5.45.00
5.44.30
5.44.20
5.44.10
5.44.00
5.43.00
5.42.00
5.41.00
5.40.00
5.39.00
5.38.20
5.38.10
5.38.00
5.37.10
5.37.00
5.36.20
5.36.10
5.36.00
5.35.00
5.34.10
5.34.00
5.33.00
5.32.00
5.31.00
5.30.10
5.30.00
5.29.20
5.29.10
5.29.00
5.28.20
5.28.10
5.28.00
5.27.10
5.27.00
5.26.00
5.25.10
5.25.00
5.24.20
5.24.10
5.24.00
5.23.170
5.23.160
5.23.150
5.23.140
5.23.130
5.23.120
5.23.110
5.23.100
5.23.90
5.23.80
5.23.70
5.23.60
5.23.50
5.23.40
5.23.30
5.23.20
5.23.10
5.23.00
5.22.00
5.21.10
5.21.00
5.20.00
5.19.00
5.18.10
5.18.00
5.17.00
5.16.00
5.15.10
5.15.00
5.14.00
5.13.00
5.12.10
5.12.00
5.11.30
5.11.20
5.11.10
5.11.00
5.10.00
5.9.00
5.8.00
5.7.10
5.7.00
5.6.20
5.6.10
5.6.00
5.5.00
5.4.10
5.4.00
5.3.20
5.3.10
5.3.00
5.2.10
5.2.00
5.1.10
5.1.00
5.0.00
4.1.10
4.1.00
4.0.00
3.5.00
3.4.00
3.3.00
3.2.00
3.1.10
3.1.00
3.0.00
2.9.00
2.8.00
2.7.00
2.6.00
2.5.10
2.5.00
2.4.00
2.3.00
2.2.00
2.1.00
2.0.00
1.6.00
1.5.00
1.4.10
1.4.00
1.3.00
1.2.00
1.1.00
1.0.10
1.0.00
0.0.0-development0
0.4.90
0.4.80
0.4.70
0.4.60
0.4.50
0.4.40
0.4.30
0.4.20
0.4.10
0.4.00
0.3.80
0.3.70
0.3.60
0.3.50
0.3.40
0.3.30
0.3.20
0.3.10
0.3.00
0.2.90
0.2.80
0.2.70
0.2.60
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i @project-r/styleguide

Weekly Downloads

35

Version

14.0.3

License

BSD-3-Clause

Unpacked Size

26.5 MB

Total Files

1757

Last publish

Collaborators

  • pae.republik
  • tpreusse
  • ruggedly