braid-design-system
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -18,2 +18,3 @@ // Import all themes up front so CSS overrides work | ||
static propTypes = { | ||
sourceUrlPrefix: PropTypes.string.isRequired, | ||
location: PropTypes.object.isRequired | ||
@@ -42,14 +43,16 @@ }; | ||
renderComponentRoute({ match }) { | ||
return <ComponentRoute componentName={match.params.componentName} />; | ||
} | ||
renderComponentRoute = ({ match }) => ( | ||
<ComponentRoute | ||
sourceUrlPrefix={this.props.sourceUrlPrefix} | ||
componentName={match.params.componentName} | ||
/> | ||
); | ||
renderIconRoute({ match }) { | ||
return ( | ||
<ComponentRoute | ||
componentName={match.params.componentName} | ||
category="icons" | ||
/> | ||
); | ||
} | ||
renderIconRoute = ({ match }) => ( | ||
<ComponentRoute | ||
sourceUrlPrefix={this.props.sourceUrlPrefix} | ||
componentName={match.params.componentName} | ||
category="icons" | ||
/> | ||
); | ||
@@ -56,0 +59,0 @@ render() { |
@@ -19,7 +19,8 @@ import React, { Component } from 'react'; | ||
componentName: PropTypes.string.isRequired, | ||
category: PropTypes.string | ||
category: PropTypes.string, | ||
sourceUrlPrefix: PropTypes.string.isRequired | ||
}; | ||
render() { | ||
const { componentName, category } = this.props; | ||
const { componentName, category, sourceUrlPrefix } = this.props; | ||
const docs = category | ||
@@ -33,5 +34,3 @@ ? require(`../../../../lib/components/${category}/${componentName}/${componentName}.docs.js`) | ||
const componentPath = category ? `${category}/` : ''; | ||
const sourceUrl = `${ | ||
process.env.SOURCE_PREFIX | ||
}/lib/components/${componentPath}${componentName}`; | ||
const sourceUrl = `${sourceUrlPrefix}/lib/components/${componentPath}${componentName}`; | ||
@@ -38,0 +37,0 @@ return ( |
@@ -7,7 +7,9 @@ import 'focus-visible'; | ||
const { routerBasename, sourceUrlPrefix } = window.CONFIG; | ||
hydrate( | ||
<BrowserRouter basename={process.env.ROUTER_BASENAME}> | ||
<App /> | ||
<BrowserRouter basename={routerBasename}> | ||
<App sourceUrlPrefix={sourceUrlPrefix} /> | ||
</BrowserRouter>, | ||
document.getElementById('app') | ||
); |
@@ -6,63 +6,52 @@ import React from 'react'; | ||
import App from './App/App'; | ||
import * as components from '../../lib/components'; | ||
const template = ({ publicPath, location }) => { | ||
const html = renderToString( | ||
<StaticRouter | ||
context={{}} | ||
location={location} | ||
basename={process.env.ROUTER_BASENAME} | ||
> | ||
<App /> | ||
</StaticRouter> | ||
); | ||
export default { | ||
renderApp: ({ route }) => { | ||
const { | ||
TRAVIS_BRANCH: branch, | ||
TRAVIS_PULL_REQUEST_SHA: prSha | ||
} = process.env; | ||
const isGithubPages = branch === 'master' && !prSha; | ||
const githubUrl = 'https://github.com/seek-oss/braid-design-system/tree/'; | ||
return dedent` | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>BRAID</title> | ||
<meta charset="utf-8"> | ||
<meta name="author" content="SEEK Group"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="robots" content="noindex"> | ||
<link rel="stylesheet" type="text/css" href="${publicPath}style.css" /> | ||
<link rel="icon" type="image/png" sizes="16x16" href="${publicPath}favicon-16x16.png" /> | ||
<link rel="icon" type="image/png" sizes="32x32" href="${publicPath}favicon-32x32.png" /> | ||
<link rel="icon" type="image/png" sizes="96x96" href="${publicPath}favicon-96x96.png" /> | ||
</head> | ||
<body><div id="app">{{ html }}</div></body> | ||
<script src="${publicPath}main.js"></script> | ||
</html> | ||
`.replace('{{ html }}', html); // Maintain indenting in 'pre' tags | ||
}; | ||
const config = { | ||
routerBasename: isGithubPages ? 'braid-design-system' : '', | ||
sourceUrlPrefix: `${githubUrl}${prSha || 'master'}` | ||
}; | ||
export default ({ publicPath }) => { | ||
const componentNames = Object.keys(components) | ||
.filter(x => !/icon/i.test(x)) | ||
.sort(); | ||
const html = renderToString( | ||
<StaticRouter | ||
context={{}} | ||
location={route} | ||
basename={config.routerBasename} | ||
> | ||
<App sourceUrlPrefix={config.sourceUrlPrefix} /> | ||
</StaticRouter> | ||
); | ||
const iconNames = Object.keys(components) | ||
.filter(x => /icon/i.test(x) && x !== 'Icon') | ||
.sort(); | ||
const publicPath = isGithubPages ? '/braid-design-system/' : '/'; | ||
return { | ||
'/': template({ publicPath, url: '/' }), | ||
...Object.assign( | ||
...componentNames.map(componentName => { | ||
const location = `/components/${componentName}/`; | ||
return { html, config, publicPath }; | ||
}, | ||
return { | ||
[location]: template({ publicPath, location }) | ||
}; | ||
}), | ||
...iconNames.map(iconName => { | ||
const location = `/icons/${iconName}/`; | ||
return { | ||
[location]: template({ publicPath, location }) | ||
}; | ||
}) | ||
) | ||
}; | ||
renderDocument: ({ headTags, bodyTags, app: { html, config, publicPath } }) => | ||
dedent` | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>BRAID</title> | ||
<meta charset="utf-8"> | ||
<meta name="author" content="SEEK Group"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="robots" content="noindex"> | ||
${headTags} | ||
<link rel="icon" type="image/png" sizes="16x16" href="${publicPath}favicon-16x16.png" /> | ||
<link rel="icon" type="image/png" sizes="32x32" href="${publicPath}favicon-32x32.png" /> | ||
<link rel="icon" type="image/png" sizes="96x96" href="${publicPath}favicon-96x96.png" /> | ||
</head> | ||
<body><div id="app">{{ html }}</div></body> | ||
<script>window.CONFIG = ${JSON.stringify(config)};</script> | ||
${bodyTags} | ||
</html> | ||
`.replace('{{ html }}', html) // Maintain indenting in 'pre' tags | ||
}; |
@@ -558,7 +558,20 @@ { | ||
}, | ||
"ErrorIcon": { | ||
"ChevronIcon": { | ||
"description": "", | ||
"displayName": "ErrorIcon", | ||
"displayName": "ChevronIcon", | ||
"methods": [], | ||
"props": { | ||
"direction": { | ||
"defaultValue": null, | ||
"description": "", | ||
"name": "direction", | ||
"parent": { | ||
"fileName": "lib/components/icons/ChevronIcon/ChevronIcon.tsx", | ||
"name": "Props" | ||
}, | ||
"required": false, | ||
"type": { | ||
"name": "\"up\" | \"down\" | \"left\" | \"right\"" | ||
} | ||
}, | ||
"size": { | ||
@@ -618,20 +631,7 @@ "defaultValue": null, | ||
}, | ||
"ChevronIcon": { | ||
"ErrorIcon": { | ||
"description": "", | ||
"displayName": "ChevronIcon", | ||
"displayName": "ErrorIcon", | ||
"methods": [], | ||
"props": { | ||
"direction": { | ||
"defaultValue": null, | ||
"description": "", | ||
"name": "direction", | ||
"parent": { | ||
"fileName": "lib/components/icons/ChevronIcon/ChevronIcon.tsx", | ||
"name": "Props" | ||
}, | ||
"required": false, | ||
"type": { | ||
"name": "\"up\" | \"down\" | \"left\" | \"right\"" | ||
} | ||
}, | ||
"size": { | ||
@@ -1034,3 +1034,3 @@ "defaultValue": null, | ||
"type": { | ||
"name": "string" | ||
"name": "node" | ||
}, | ||
@@ -1132,2 +1132,33 @@ "required": true, | ||
}, | ||
"FieldMessage": { | ||
"description": "", | ||
"displayName": "FieldMessage", | ||
"methods": [], | ||
"props": { | ||
"theme": { | ||
"type": { | ||
"name": "object" | ||
}, | ||
"required": true, | ||
"description": "", | ||
"defaultValue": null | ||
}, | ||
"tone": { | ||
"type": { | ||
"name": "\"critical\" | \"positive\"" | ||
}, | ||
"required": false, | ||
"description": "", | ||
"defaultValue": null | ||
}, | ||
"message": { | ||
"type": { | ||
"name": "\"false\" | node" | ||
}, | ||
"required": false, | ||
"description": "", | ||
"defaultValue": null | ||
} | ||
} | ||
}, | ||
"Radio": { | ||
@@ -1270,34 +1301,3 @@ "description": "", | ||
} | ||
}, | ||
"FieldMessage": { | ||
"description": "", | ||
"displayName": "FieldMessage", | ||
"methods": [], | ||
"props": { | ||
"theme": { | ||
"type": { | ||
"name": "object" | ||
}, | ||
"required": true, | ||
"description": "", | ||
"defaultValue": null | ||
}, | ||
"tone": { | ||
"type": { | ||
"name": "\"critical\" | \"positive\"" | ||
}, | ||
"required": false, | ||
"description": "", | ||
"defaultValue": null | ||
}, | ||
"message": { | ||
"type": { | ||
"name": "\"false\" | node" | ||
}, | ||
"required": false, | ||
"description": "", | ||
"defaultValue": null | ||
} | ||
} | ||
} | ||
} |
@@ -34,3 +34,3 @@ import React from 'react'; | ||
checked: PropTypes.bool.isRequired, | ||
label: PropTypes.string.isRequired, | ||
label: PropTypes.node.isRequired, | ||
disabled: PropTypes.bool, | ||
@@ -37,0 +37,0 @@ className: PropTypes.string, |
{ | ||
"name": "braid-design-system", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Themeable design system for the SEEK Group", | ||
@@ -101,3 +101,3 @@ "main": "lib/components/index.js", | ||
"lodash": "^4.17.11", | ||
"playroom": "0.6.0", | ||
"playroom": "0.7.1", | ||
"postcss-js": "^2.0.0", | ||
@@ -115,3 +115,3 @@ "postcss-loader": "^3.0.0", | ||
"semantic-release": "^15.10.8", | ||
"sku": "6.2.2", | ||
"sku": "7.2.4", | ||
"style-loader": "^0.23.1", | ||
@@ -118,0 +118,0 @@ "surge": "^0.20.1", |
@@ -1,26 +0,15 @@ | ||
const { TRAVIS_BRANCH, TRAVIS_PULL_REQUEST_SHA } = process.env; | ||
const isGitHubPages = TRAVIS_BRANCH === 'master' && !TRAVIS_PULL_REQUEST_SHA; | ||
const routes = require('./sku.routes.js'); | ||
const ref = TRAVIS_PULL_REQUEST_SHA || 'master'; | ||
const sourcePrefix = `https://github.com/seek-oss/braid-design-system/tree/${ref}`; | ||
const isGitHubPages = | ||
process.env.TRAVIS_BRANCH === 'master' && | ||
!process.env.TRAVIS_PULL_REQUEST_SHA; | ||
module.exports = { | ||
srcPaths: ['lib', 'docs/src', 'scripts'], | ||
entry: { | ||
client: 'docs/src/client.js', | ||
render: 'docs/src/render.js' | ||
}, | ||
clientEntry: 'docs/src/client.js', | ||
renderEntry: 'docs/src/render.js', | ||
routes, | ||
public: 'docs/src/public', | ||
target: 'docs/dist', | ||
publicPath: isGitHubPages ? '/braid-design-system/' : '/', | ||
env: { | ||
ROUTER_BASENAME: { | ||
development: '', | ||
production: isGitHubPages ? 'braid-design-system' : '' | ||
}, | ||
SOURCE_PREFIX: { | ||
development: sourcePrefix, | ||
production: sourcePrefix | ||
} | ||
} | ||
publicPath: isGitHubPages ? '/braid-design-system/' : '/' | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
397
4596977
12270
11