Primer Blueprints
This project hosts React components and utilities for building Primer documentation sites.
:point_right: Visit primer.style/blueprints to learn more!
Installation
npm install @primer/blueprints react react-dom styled-components
Usage
Wrap your configuration in the @primer/blueprints/configure
export in your project's next.config.js
:
const configure = require('@primer/blueprints/configure')
module.exports = configure({
env: {
}
})
Now v2
When deploying to Now v2, be sure to provide the target: 'serverless'
configuration option:
module.exports = configure({
+ target: 'serverless', // required for Now v2
env: {
// your env vars here
}
})
Configuration features
Our configuration provides the following features:
-
Conversion of .svg
files into React components with svgr, as in:
import SomeImage from '../assets/some-image.svg'
export default props => <SomeImage width="100%" {...props} />
-
Export of bitmap images (.gif
, .jpg
, .png
, and .ico
) as static files with file-loader:
import myImagePath from '../assets/image.gif'
export default props => <img src={myImagePath} {...props} />
-
MDX support, plus a bunch of other goodies:
Components
General-purpose React components are available as named exports from @primer/blueprints
:
import {Header, ClipboardCopy, StatusLabel} from '@primer/blueprints'
Next.js components
React components for use in Next.js sites are only exported from @primer/blueprints/next-components
:
import {Link, Frame, CodeExample} from '@primer/blueprints/next-components'