Skip to content

Deploy with Now, inline CSS #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
43b03e6
set top, zIndex default props on Sticky
shawnbot Aug 17, 2018
9be4fcd
make top nav sticky, simplify App
shawnbot Aug 17, 2018
15724d5
just export the component page
shawnbot Aug 17, 2018
7338865
add pl={3} to examples top nav
shawnbot Aug 17, 2018
853fa75
refactor SideNav to take basename, etc.
shawnbot Aug 17, 2018
e03897b
add examples/doc-components/index; kill GitHubAvatar
shawnbot Aug 17, 2018
839c2f6
add custom Library component to replace kit's
shawnbot Aug 17, 2018
1b23930
use new Library, add landing route for Demos
shawnbot Aug 17, 2018
dc758b3
use new Library, add landing route for Components
shawnbot Aug 17, 2018
de145fd
lint
shawnbot Aug 17, 2018
a01d902
clean up doc-components imports
shawnbot Aug 17, 2018
d31377f
tidy up Flex examples
shawnbot Aug 17, 2018
eebf010
tidy demo code samples
shawnbot Aug 17, 2018
89ece36
tidy up Library and example listings
shawnbot Aug 17, 2018
ffc9755
simplify SideNav
shawnbot Aug 17, 2018
7df0063
add widths to Library columns
shawnbot Aug 17, 2018
c130602
shrink SideNav box
shawnbot Aug 17, 2018
86a619d
set examples top nav z-index to 100
shawnbot Aug 17, 2018
c2e07c2
reorganize demos
shawnbot Aug 17, 2018
2496f80
sort Library examples alphabetically
shawnbot Aug 17, 2018
9ab97b4
factor out redundant example constant names
shawnbot Aug 17, 2018
5ba47ae
add home page link, dry up top nav
shawnbot Aug 17, 2018
05c803b
massage whitespace around content area
shawnbot Aug 17, 2018
8a714b9
linkt
shawnbot Aug 17, 2018
1319771
[skip ci] build docs
shawnbot Aug 17, 2018
d92297c
[skip ci] skip ci plz
shawnbot Aug 17, 2018
216325c
[skip ci] update bundle
shawnbot Aug 17, 2018
a6b8970
[skip ci] Merge remote-tracking branch 'origin/release-2.0.0-beta' in…
shawnbot Aug 17, 2018
634cfa4
remove home page
shawnbot Aug 17, 2018
64ebb46
remove home page link, octicon
shawnbot Aug 17, 2018
743526c
move html.js -> examples/.html.js
shawnbot Aug 17, 2018
5633a88
[skip ci] rebuild docs
shawnbot Aug 17, 2018
5a1b18a
bring back flexDirection
shawnbot Aug 17, 2018
c3979bf
[skip ci] rebuild docs
shawnbot Aug 17, 2018
f87779e
Merge remote-tracking branch 'origin/release-2.0.0-beta' into fewer-s…
shawnbot Aug 17, 2018
960dad5
[skip ci] Merge remote-tracking branch 'origin/master' into fewer-scr…
shawnbot Aug 17, 2018
675b591
try fixed basename
shawnbot Aug 20, 2018
db058bb
[skip ci] update docs
shawnbot Aug 20, 2018
b76d9b8
[skip ci] derp, fix /demos/ basename
shawnbot Aug 20, 2018
5041ca9
[skip ci] update docs again
shawnbot Aug 20, 2018
7573b46
add trailing slash to top nav links
shawnbot Aug 20, 2018
e54aa42
[skip ci] update docs
shawnbot Aug 20, 2018
7c26a14
[skip ci] use primer.github.io favicon
shawnbot Aug 20, 2018
31d7680
tidy up colors demo
shawnbot Aug 20, 2018
d6be18a
flesh out CircleOcticon examples
shawnbot Aug 20, 2018
9837a73
remove <Box> from MergeBox and MergeButton demos
shawnbot Aug 20, 2018
83a69b6
[skip ci] build docs
shawnbot Aug 20, 2018
8f8b7c2
suggest node >=8
shawnbot Aug 21, 2018
47d8c78
nix basename from redirect URL, tidy
shawnbot Aug 21, 2018
0904e9c
rename .html.js to _html.js, tidy
shawnbot Aug 21, 2018
15fd3bb
rename build run-script to dist
shawnbot Aug 21, 2018
088a958
add now.json for static deployment
shawnbot Aug 21, 2018
ab4c5eb
update package-lock.json
shawnbot Aug 21, 2018
821eb84
[skip ci] rebuild docs
shawnbot Aug 21, 2018
fd73f5c
lint
shawnbot Aug 21, 2018
3e38e6e
add local favicon.png
shawnbot Aug 21, 2018
d255182
add primer-react.scs
shawnbot Aug 21, 2018
0037a30
add primer-react CSS export
shawnbot Aug 21, 2018
d675c63
inline the css
shawnbot Aug 21, 2018
edf5454
update package-lock.json
shawnbot Aug 21, 2018
35beea3
use our Octicon with utility props
shawnbot Aug 21, 2018
d3858ca
ok maybe we do need primer-utilities
shawnbot Aug 21, 2018
fe9b395
factor out utility classes in examples
shawnbot Aug 21, 2018
a57eb39
install primer-utilities
shawnbot Aug 21, 2018
133f8e1
add deploy run script
shawnbot Aug 21, 2018
317ce9a
[skip ci] rebuild docs
shawnbot Aug 21, 2018
6637913
fix padding on docs
shawnbot Aug 21, 2018
55142ab
include primer-css subset in Styles component, not in HTML template
shawnbot Aug 21, 2018
c50bb20
DRY up Library component with Content block
shawnbot Aug 21, 2018
d6ab271
[skip ci] rebuild docs
shawnbot Aug 21, 2018
048d26a
lint
shawnbot Aug 21, 2018
b899d03
[skip ci] build docs
shawnbot Aug 21, 2018
4b063e6
move styles up to avoid FOUC
shawnbot Aug 21, 2018
f3df934
[skip ci] build docs
shawnbot Aug 21, 2018
d0e0fdf
move primer CSS back into <head>
shawnbot Aug 21, 2018
92b37aa
[skip ci] build docs
shawnbot Aug 21, 2018
b8fff5e
lint
shawnbot Aug 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
],
"plugins": [
"add-react-displayname",
"transform-object-rest-spread"
"transform-object-rest-spread",
"preval"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this babel plugin to inline the CSS.

]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.DS_Store
coverage/
dist/
docs/TEMP/
node_modules
npm-debug.log
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node_js:
script:
- npm run lint
- npm test
- npm run build
- npm run dist
- npm run build:docs

notifications:
Expand Down
7 changes: 1 addition & 6 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />

<title>primer-react</title>

<script>
sessionStorage.redirect = location.href;
</script>

<meta http-equiv="refresh" content="0;URL='/primer-react'"></meta>
<meta http-equiv="refresh" content="0;URL=/"></meta>
</head>

<body>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down
Binary file added docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 21 additions & 21 deletions docs/bundle.js

Large diffs are not rendered by default.

318 changes: 16 additions & 302 deletions docs/components/index.html

Large diffs are not rendered by default.

37 changes: 16 additions & 21 deletions docs/demos/index.html

Large diffs are not rendered by default.

318 changes: 16 additions & 302 deletions docs/index.html

Large diffs are not rendered by default.

43 changes: 22 additions & 21 deletions docs/sandbox/index.html

Large diffs are not rendered by default.

51 changes: 24 additions & 27 deletions examples/_app.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
import React from 'react'
import {ThemeProvider} from 'emotion-theming'
import PropTypes from 'prop-types'
import {Package} from '@githubprimer/octicons-react'
import {NavLink} from 'react-router-dom'
import Styles from './doc-components/Styles'
import Octicon, {Package} from '@githubprimer/octicons-react'
import {Box, Link, Text, UnderlineNav, UnderlineNavLink, theme} from '../src'
import {Styles} from './doc-components'
import Octicon from '../src/Octicon'
import {Box, Link, Sticky, Text, UnderlineNav, UnderlineNavLink} from '../src'
import {name, repository, version} from '../package.json'

const pkg = `${name}@${version}`
const releaseURL = `https://github.com/${repository}/releases/v${version}`

function TopNavLink(props) {
return <UnderlineNavLink is={NavLink} px={3} {...props} />
}

export default function Page({render}) {
return (
<React.Fragment>
<Styles />
<ThemeProvider theme={theme}>
<Box color="bodytext">
<UnderlineNav
actions={
<Text color="gray.5" fontFamily="mono" px={4}>
<Octicon icon={Package} className="mr-2" />
<Link href={releaseURL}>{pkg}</Link>
</Text>
}
>
<UnderlineNavLink is={NavLink} to="/components" px={3}>
Components
</UnderlineNavLink>
<UnderlineNavLink is={NavLink} to="/demos" px={3}>
Demos
</UnderlineNavLink>
<UnderlineNavLink is={NavLink} to="/sandbox" px={3}>
Sandbox
</UnderlineNavLink>
</UnderlineNav>
<Box p={3}>{render()}</Box>
</Box>
</ThemeProvider>
<Sticky bg="white" zIndex={100}>
<UnderlineNav
pl={3}
actions={
<Text color="gray.5" fontFamily="mono" px={4}>
<Octicon icon={Package} mr={2} />
<Link href={releaseURL}>{pkg}</Link>
</Text>
}
>
<TopNavLink to="/components/">Components</TopNavLink>
<TopNavLink to="/demos/">Demos</TopNavLink>
<TopNavLink to="/sandbox/">Sandbox</TopNavLink>
</UnderlineNav>
</Sticky>
<Box p={3}>{render()}</Box>
</React.Fragment>
)
}
Expand Down
29 changes: 29 additions & 0 deletions examples/_html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const css = require('../src/css')

module.exports = ({html = '', scripts, title = 'primer-react', static: staticBuild}) =>
`<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
<meta name='viewport' content='width=device-width,initial-scale=1' />
<meta name='generator' content='Compositor X0' />
<meta name='og:title' content='Primer React' />
<meta name='description' content='Primer components built with React.js.' />
<link rel='icon' href='/assets/favicon.png' />
<style id="primer-css">${css}</style>
</head>
<body>
<script>
(function() {
var redirect = sessionStorage.redirect
delete sessionStorage.redirect
if (redirect && redirect !== location.href) {
history.replaceState(null, null, redirect)
}
})()
</script>
<div id="root">${html}</div>
</body>
</html>
${staticBuild ? '' : scripts}
`
4 changes: 1 addition & 3 deletions examples/component-examples/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {Box, Avatar} from '../../src'

const AvatarExample = {
export default {
name: 'Avatar',
element: (
<div>
Expand Down Expand Up @@ -33,5 +33,3 @@ const AvatarExample = {
</div>
)
}

export default AvatarExample
4 changes: 1 addition & 3 deletions examples/component-examples/BorderBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {BorderBox, Box} from '../../src'

const BorderBoxExample = {
export default {
name: 'BorderBox',
element: (
<div>
Expand Down Expand Up @@ -45,5 +45,3 @@ const BorderBoxExample = {
</div>
)
}

export default BorderBoxExample
4 changes: 1 addition & 3 deletions examples/component-examples/Box.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const colors = [...Object.entries(theme.colors)].reduce((keys, [key, value]) =>

const textColors = ['white', 'gray.5', 'black']

const BoxExample = {
export default {
name: 'Box',
element: (
<div>
Expand Down Expand Up @@ -64,5 +64,3 @@ const BoxExample = {
</div>
)
}

export default BoxExample
6 changes: 2 additions & 4 deletions examples/component-examples/BranchName.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import Octicon, {GitBranch} from '@githubprimer/octicons-react'
import {Detail, LiveEditor} from '@compositor/kit'
import ExampleHeading from '../doc-components/ExampleHeading'
import {ExampleHeading} from '../doc-components'
import {BranchName} from '../../src'

const linkedBranch = `<BranchName is="a" href="/">
Expand All @@ -13,7 +13,7 @@ const branchOcticon = `<BranchName>
a_new_feature_branch
</BranchName>`

const BranchNameExample = {
export default {
name: 'BranchName',
element: (
<div>
Expand All @@ -27,5 +27,3 @@ const BranchNameExample = {
</div>
)
}

export default BranchNameExample
6 changes: 2 additions & 4 deletions examples/component-examples/Buttons.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import {Hubot, Pencil, X} from '@githubprimer/octicons-react'
import {LiveEditor} from '@compositor/kit'
import ExampleHeading from '../doc-components/ExampleHeading'
import {ExampleHeading} from '../doc-components'
import {Box, Button, ButtonLink, ButtonDanger, ButtonPrimary, ButtonOutline, OcticonButton, Text} from '../../src'

const ButtonExample = {
export default {
name: 'Buttons',
element: (
<div>
Expand Down Expand Up @@ -58,5 +58,3 @@ const ButtonExample = {
</div>
)
}

export default ButtonExample
4 changes: 1 addition & 3 deletions examples/component-examples/CircleBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sizes = `<CircleBadge bg="blue.5" size="small"><img src="https://avatars0.
<CircleBadge bg="blue.5" size="medium"><img src="https://avatars0.githubusercontent.com/t/1929972?s=280&v=4"/></CircleBadge>
<CircleBadge bg="blue.5" size="large"><img src="https://avatars0.githubusercontent.com/t/1929972?s=280&v=4"/></CircleBadge>`

const CircleBadgeExample = {
export default {
name: 'CircleBadge',
element: (
<div>
Expand All @@ -36,5 +36,3 @@ const CircleBadgeExample = {
</div>
)
}

export default CircleBadgeExample
24 changes: 13 additions & 11 deletions examples/component-examples/CircleOcticon.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import React from 'react'
import {Check} from '@githubprimer/octicons-react'
import {Check, X, Zap} from '@githubprimer/octicons-react'
import {LiveEditor} from '@compositor/kit'
import {CircleOcticon} from '../../src'
import {CircleOcticon, FlexContainer} from '../../src'

const CircleOcticonExample = {
export default {
name: 'CircleOcticon',
element: (
<div className="d-flex">
<LiveEditor
code={`<CircleOcticon icon={Check} size={32} bg="green.5" color="white" />`}
scope={{CircleOcticon, Check}}
/>
</div>
<LiveEditor
code={`
<FlexContainer>
<CircleOcticon icon={Check} size={32} bg="green.5" color="white" mr={2} />
<CircleOcticon icon={Zap} size={48} bg="blue.5" color="white" mr={2} />
<CircleOcticon icon={X} size={64} bg="red.5" color="white" mr={2} />
</FlexContainer>
`.trim()}
scope={{CircleOcticon, Check, FlexContainer, X, Zap}}
/>
)
}

export default CircleOcticonExample
4 changes: 1 addition & 3 deletions examples/component-examples/CounterLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {CounterLabel} from '../../src'

const CounterLabelExample = {
export default {
name: 'CounterLabel',
element: (
<div>
Expand All @@ -12,5 +12,3 @@ const CounterLabelExample = {
</div>
)
}

export default CounterLabelExample
6 changes: 2 additions & 4 deletions examples/component-examples/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {Box, Details} from '../../src'
import ExampleHeading from '../doc-components/ExampleHeading'
import {ExampleHeading} from '../doc-components'

const example1 = `<Details>
<summary className="btn">Click me</summary>
Expand All @@ -22,7 +22,7 @@ const example2 = `<Details>
</Details>
`

const DetailsExample = {
export default {
name: 'Details',
element: (
<div>
Expand All @@ -41,5 +41,3 @@ const DetailsExample = {
</div>
)
}

export default DetailsExample
6 changes: 2 additions & 4 deletions examples/component-examples/DonutChart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {Box, DonutChart, Text, DonutSlice, theme} from '../../src'
import ExampleHeading from '../doc-components/ExampleHeading'
import {ExampleHeading} from '../doc-components'

const dataPropExample = `<DonutChart mr={1} data={{error: 2, pending: 3, success: 5}} />
<DonutChart mr={1} data={{error: 1, pending: 4, success: 2}} />
Expand Down Expand Up @@ -49,7 +49,7 @@ const customColorsExample = `<DonutChart>
<DonutSlice value={1} fill={theme.colors.purple[4]} />
</DonutChart>`

const DonutChartExample = {
export default {
name: 'DonutChart',
element: (
<div>
Expand All @@ -74,5 +74,3 @@ const DonutChartExample = {
</div>
)
}

export default DonutChartExample
18 changes: 8 additions & 10 deletions examples/component-examples/Dropdown.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import React from 'react'
import {LiveEditor} from '@compositor/kit'
import {Box, Dropdown, Link} from '../../src'
import ExampleHeading from '../doc-components/ExampleHeading'
import {ExampleHeading} from '../doc-components'

const dropdownPrimary = `<Dropdown scheme="primary" minWidth="5em">
<ul className="list-style-none m-0 p-0">
<Box is="ul" m={0} p={0} className="list-style-none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</Box>
</Dropdown>`

const dropdown = `<Dropdown minWidth="5em">
<ul className="list-style-none m-0 p-0">
<Box is="ul" m={0} p={0} className="list-style-none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</Box>
</Dropdown>`

const dropdownTitle = `<Dropdown title="Options" minWidth="5em">
<ul className="list-style-none m-0 p-0">
<Box is="ul" m={0} p={0} className="list-style-none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</Box>
</Dropdown>`

const scope = {Box, Dropdown, Link}

const DropdownExample = {
export default {
name: 'Dropdown',
element: (
<div>
Expand All @@ -48,5 +48,3 @@ const DropdownExample = {
</div>
)
}

export default DropdownExample
Loading