-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #710 from primer/release-12.1.1
Release Tracking 12.1.1
- Loading branch information
Showing
102 changed files
with
6,656 additions
and
5,891 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
.changelog | ||
.next/ | ||
.sass-cache | ||
.storybuild/ | ||
_site | ||
build/ | ||
dist/ | ||
node_modules/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": [ | ||
"plugin:github/react" | ||
], | ||
"rules": { | ||
"import/no-namespace": 0 | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
import '@storybook/addon-options/register' | ||
import '@storybook/addon-viewport/register' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,46 @@ | ||
import React from 'react' | ||
import { configure, addDecorator } from '@storybook/react' | ||
import { setOptions } from '@storybook/addon-options' | ||
import '../modules/primer/index.scss' | ||
import { version } from '../modules/primer/package.json' | ||
import {configure, addParameters, addDecorator} from '@storybook/react' | ||
import {name, homepage, version} from '../package.json' | ||
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport' | ||
|
||
setOptions({ | ||
name: `Primer v${version}`, | ||
url: 'http://primer.github.io/', | ||
showDownPanel: false, | ||
}) | ||
// this enables HMR for the SCSS source files | ||
import '../src/index.scss' | ||
|
||
addDecorator(story => ( | ||
<div className='p-4'> | ||
{story()} | ||
</div> | ||
)) | ||
// wrap every view in 4x padding | ||
addDecorator(story => <div className="p-4">{story()}</div>) | ||
|
||
const contexts = [ | ||
require.context('../modules', true, /stories.*\.js$/), | ||
] | ||
addParameters({ | ||
options: { | ||
brandTitle: `${name}@${version}`, | ||
brandUrl: homepage, | ||
showAddonsPanel: false | ||
}, | ||
viewport: { | ||
viewports: { | ||
sm: { | ||
name: 'Small ($width-sm)', | ||
styles: {width: '544px', height: 'auto'} | ||
}, | ||
md: { | ||
name: 'Medium ($width-md)', | ||
styles: {width: '768px', height: 'auto'} | ||
}, | ||
lg: { | ||
name: 'Large ($width-lg)', | ||
styles: {width: '1012px', height: 'auto'} | ||
}, | ||
xl: { | ||
name: 'XL ($width-xl)', | ||
styles: {width: '1280px', height: 'auto'} | ||
}, | ||
...INITIAL_VIEWPORTS | ||
} | ||
} | ||
}) | ||
|
||
configure(() => { | ||
contexts.forEach(context => { | ||
context.keys() | ||
.filter(key => !key.includes('node_modules')) | ||
.forEach(context) | ||
}) | ||
const loadMarkdown = require.context('../pages/css', true, /\.md$/) | ||
for (const path of loadMarkdown.keys()) { | ||
loadMarkdown(path) | ||
} | ||
}, module) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<link rel="stylesheet" href="https://unpkg.com/octicons@7.0.1/build/build.css"> | ||
<link rel="stylesheet" href="https://unpkg.com/octicons@8.5.0/build/build.css"> | ||
<script src="https://github.com/site/assets/styleguide.js" async></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-disable no-console */ | ||
const {basename, dirname, join} = require('path') | ||
const parseFromString = require('code-blocks/lib/fromString') | ||
|
||
module.exports = function storyLoader(markdown) { | ||
// resourcePath is the full path ("/Users/probot/primer/css/...") to the file being parsed | ||
// rootContext is really just dirname(resourcePath) | ||
const {resourcePath = '', rootContext} = this | ||
|
||
// the sourcePath option provides a way to collapse the | ||
// navigation hierarchy by trimming even more of the | ||
// resourcePath's prefix; if it's not provided, use the | ||
// rootContext | ||
const {sourcePath = rootContext} = this.query || {} | ||
|
||
// strip the sourcePath from the beginning of the resourcePath | ||
const file = resourcePath.replace(`${sourcePath}/`, '') | ||
const path = join(dirname(file), basename(file, '.md')) | ||
|
||
const stories = storiesFromMarkdown(markdown, file) | ||
if (stories.length) { | ||
console.warn(`${stories.length} stories found in ${file}!`) | ||
return ` | ||
const {storiesOf} = require('@storybook/react') | ||
const htmlToReact = require('html-to-react') | ||
const chapter = storiesOf(${JSON.stringify(path)}, module) | ||
const stories = ${JSON.stringify(stories)} | ||
const htmlParser = new htmlToReact.Parser() | ||
for (const {title, value} of stories) { | ||
chapter.add(title, () => htmlParser.parse(value)) | ||
} | ||
` | ||
} else { | ||
return `module.exports = {markdown: ${JSON.stringify(markdown)}}` | ||
} | ||
} | ||
|
||
function storiesFromMarkdown(markdown, file) { | ||
const path = file.replace(/^\.\//, '') | ||
return parseFromString(markdown, path).filter(block => { | ||
// yes: ```html | ||
// no: ```html dead | ||
// no: ```html inert | ||
return block.lang === 'html' && !block.info.dead && !block.info.inert | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.