Skip to content

Commit 507612d

Browse files
author
Emily Plummer
committed
Merge branch 'master' into release-14.0.0
2 parents 93fac79 + 65b41bb commit 507612d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+23716
-8532
lines changed

.babelrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"presets": [
3-
"next/babel"
3+
["@babel/preset-react", {"modules": false}],
4+
["@babel/preset-env", {"modules": false}]
45
],
56
"plugins": [
67
"macros",
78
"add-react-displayname",
8-
"babel-plugin-styled-components"
9+
"babel-plugin-styled-components",
10+
"@babel/plugin-proposal-object-rest-spread"
911
],
1012
"env": {
1113
"test": {
1214
"presets": [
13-
["next/babel", {"preset-env": {"modules": "commonjs"}}]
15+
["@babel/preset-react", {"modules": "commonjs"}],
16+
["@babel/preset-env", {"modules": "commonjs"}]
1417
]
1518
}
1619
}

.github/main.workflow

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Primer Components Workflow
2+
on: [push]
3+
4+
jobs:
5+
publish:
6+
name: Publish
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
11+
- name: Install dependencies
12+
run: npm ci
13+
14+
- name: Lint
15+
run: npm run lint
16+
17+
- name: Test
18+
run: npm test
19+
20+
- name: Publish to the npm registry
21+
uses: "primer/publish@v2.0.0"
22+
with:
23+
args: "-- --unsafe-perm --allow-same-version"
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
.*.swp
1+
.test
2+
node_modules
23
.DS_Store
3-
*.log
4-
*.tgz
5-
.next/
6-
.test/
74
coverage/
85
dist/
9-
node_modules

CONTRIBUTING.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,10 @@ Categories of system props are exported from `src/constants.js`:
100100

101101
## Writing documentation
102102

103-
We use [Next.js](https://github.com/zeit/next.js/) and [MDX Docs](https://github.com/jxnblk/mdx-docs/) to power our documentation site at [https://primer.style/components](https://primer.style/components/).
103+
We use [Doctocat](https://github.com/primer/doctocat) to power our documentation site at [https://primer.style/components](https://primer.style/components/).
104104

105-
To add a new component to our documentation site:
105+
To add a new component to our documentation site, create a new file with the `.md` extension for your component in `docs/content/components`.
106106

107-
1. Create a new file with the `.md` extension for your component in `pages/components/docs`.
108-
2. Copy & paste the template from `doc-template.md` & replace placeholder brackets with relevant information.
109-
3. Add the new file to the `index.js` in `pages/components/docs`
110107

111108
## Deployment
112109
We deploy the Primer Components site using [Now]. Install the Now CLI and log in with:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const App = (props) => {
117117

118118
#### Static CSS rendering
119119

120-
If you're rendering React components both server-side _and_ client-side, we suggest following [styled-component's server-side rendering instructions](https://www.styled-components.com/docs/advanced#server-side-rendering) to avoid the flash of unstyled content for server-rendered components. This repo's [documentation template component](https://github.com/primer/components/blob/master/pages/_document.js) demonstrates how to do this in [Next.js].
120+
If you're rendering React components both server-side _and_ client-side, we suggest following [styled-component's server-side rendering instructions](https://www.styled-components.com/docs/advanced#server-side-rendering) to avoid the flash of unstyled content for server-rendered components.
121121

122122
## Local Development
123123

@@ -143,4 +143,3 @@ To run `@primer/components` locally when adding or updating components:
143143
[styled-components]: https://www.styled-components.com/docs
144144
[Primer CSS]: https://github.com/primer/primer
145145
[flash of unstyled content]: https://en.wikipedia.org/wiki/Flash_of_unstyled_content
146-
[Next.js]: https://github.com/zeit/next.js

docs/.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
.env.test
68+
69+
# parcel-bundler cache (https://parceljs.org/)
70+
.cache
71+
72+
# next.js build output
73+
.next
74+
75+
# nuxt.js build output
76+
.nuxt
77+
78+
# vuepress build output
79+
.vuepress/dist
80+
81+
# Serverless directories
82+
.serverless/
83+
84+
# FuseBox cache
85+
.fusebox/
86+
87+
# DynamoDB Local files
88+
.dynamodb/
89+
90+
# Gatsby
91+
public/
File renamed without changes.
File renamed without changes.

docs/components/constants.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import * as styledSystem from 'styled-system'
2+
import PropTypes from 'prop-types'
3+
import systemPropTypes from '@styled-system/prop-types'
4+
import themeGet from '@styled-system/theme-get'
5+
import {theme} from '@primer/components'
6+
7+
const {get: getKey, compose, system} = styledSystem
8+
9+
export const get = key => themeGet(key, getKey(theme, key))
10+
11+
const whiteSpace = system({
12+
whiteSpace: {
13+
property: 'whiteSpace',
14+
cssProperty: 'whiteSpace'
15+
}
16+
})
17+
18+
export const TYPOGRAPHY = compose(
19+
styledSystem.typography,
20+
whiteSpace
21+
)
22+
23+
TYPOGRAPHY.propTypes = {
24+
...systemPropTypes.typography,
25+
whiteSpace: PropTypes.oneOf(['normal', 'nowrap', 'pre-wrap', 'pre', 'pre-line'])
26+
}
27+
28+
export const COMMON = compose(
29+
styledSystem.space,
30+
styledSystem.color,
31+
styledSystem.display
32+
)
33+
COMMON.propTypes = {
34+
...systemPropTypes.space,
35+
...systemPropTypes.color
36+
}
37+
export const BORDER = compose(
38+
styledSystem.border,
39+
styledSystem.shadow
40+
)
41+
BORDER.propTypes = {
42+
...systemPropTypes.border,
43+
...systemPropTypes.shadow
44+
}
45+
46+
// these are 1:1 with styled-system's API now,
47+
// so you could consider dropping the abstraction
48+
export const LAYOUT = styledSystem.layout
49+
export const POSITION = styledSystem.position
50+
export const FLEX = styledSystem.flexbox
51+
export const GRID = styledSystem.grid
52+
53+
TYPOGRAPHY.propTypes = systemPropTypes.typography
54+
LAYOUT.propTypes = systemPropTypes.layout
55+
POSITION.propTypes = systemPropTypes.position
56+
FLEX.propTypes = systemPropTypes.flexbox
57+
GRID.propTypes = systemPropTypes.grid

0 commit comments

Comments
 (0)