Skip to content

Commit

Permalink
push lab forward
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 19, 2018
1 parent 602f4af commit fca1061
Show file tree
Hide file tree
Showing 76 changed files with 831 additions and 8,579 deletions.
16 changes: 8 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"development": {
"sourceMaps": "both",
"plugins": [
"transform-flow-strip-types",
"transform-flow-strip-types"
]
},
"docs-development": {
Expand All @@ -27,11 +27,11 @@
"module-resolver",
{
"alias": {
"pages": "./pages",
"@material-ui/lab": "./packages/lab/src",
"@material-ui/lab": "./packages/material-ui-lab/src",
"docs": "./docs",
"material-ui": "./src",
"material-ui-icons": "./packages/material-ui-icons/src",
"docs": "./docs"
"pages": "./pages"
}
}
],
Expand All @@ -48,11 +48,11 @@
"module-resolver",
{
"alias": {
"pages": "./pages",
"@material-ui/lab": "./packages/material-ui-lab/src",
"docs": "./docs",
"material-ui": "./src",
"@material-ui/lab": "./packages/lab/src",
"material-ui-icons": "./packages/material-ui-icons/src",
"docs": "./docs"
"pages": "./pages"
}
}
],
Expand Down Expand Up @@ -100,7 +100,7 @@
{
"alias": {
"material-ui": "./src",
"material-ui-icons": "./packages/material-ui-icons/src",
"material-ui-icons": "./packages/material-ui-icons/src"
}
}
],
Expand Down
13 changes: 8 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: /tmp/material-ui
docker:
- image: circleci/node:6.11
- image: circleci/node:9.5
restore_repo: &restore_repo
restore_cache:
keys:
Expand All @@ -26,7 +26,10 @@ jobs:
key: v1-yarn-sha-{{ checksum "yarn.lock" }}
- run:
name: Install js dependencies
command: yarn install --frozen-lockfile
command: yarn
- run:
name: Should not have any git not staged
command: git diff --exit-code
- save_cache:
key: v1-yarn-sha-{{ checksum "yarn.lock" }}
paths:
Expand Down Expand Up @@ -66,7 +69,7 @@ jobs:
# This isn't user facing code.
# Let's take advantage of the most up to date node version.
docker:
- image: circleci/node:9.4
- image: circleci/node:9.5
steps:
- *restore_repo
- run:
Expand Down Expand Up @@ -94,8 +97,8 @@ jobs:
test_regressions:
<<: *defaults
docker:
- image: circleci/node:6.11
- image: selenium/standalone-chrome:3.4.0
- image: circleci/node:9.5
- image: selenium/standalone-chrome:3.9.0
steps:
- *restore_repo
- run:
Expand Down
27 changes: 13 additions & 14 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
node_modules
/build
/tmp
coverage
/.git
/.next
/coverage
/docs/export
flow
flow-typed
/packages/*/lib
/packages/material-ui-icons/test/fixtures
/examples/create-react-app-with-flow/flow
/examples/create-react-app-with-flow/flow-typed
/examples/gatsby/public
/flow
/flow-typed
/packages/material-ui-codemod/lib
/packages/material-ui-codemod/src/*/*.spec*
/packages/material-ui-icons/src
/packages/material-ui-icons/test/fixtures
/packages/material-ui-icons/tpl
/packages/material-ui-icons/build
/packages/material-ui-codemod/src/*/*.spec*
/examples/create-react-app/build
/examples/create-react-app-with-jss/build
/examples/gatsby/public
/.git
/tmp
build
node_modules
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

module.exports = {
// So parent files don't get applied
root: true,
Expand All @@ -20,7 +22,7 @@ module.exports = {
settings: {
'import/resolver': {
webpack: {
config: './docs/webpackBaseConfig.js',
config: path.join(__dirname, './docs/webpackBaseConfig.js'),
},
},
},
Expand Down
36 changes: 15 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# Exclude compiled files
build
/lib
/.next
/.eslintcache
/docs/export
/tmp
/coverage
/.nyc_output

# OS files
.DS_STORE
# The best pattern people should follow is ignoring the editors' files in their
# global .gitignore configuration file.
# However, in order to prevent issues. We also ignore editors' files here.
.idea
.vscode

# Screenshors generated for Argos-CI
*.log
.DS_STORE
/.eslintcache
/.next
/.nyc_output
/coverage
/docs/export
/packages/material-ui-codemod/lib
/test/regressions/screenshots
/test/selenium-output

# npm files
/tmp
build
node_modules
package-lock.json
*.log

# The best pattern people should follow is ignoring the editors' files in their
# global .gitignore configuration file.
# However, in order to prevent issues. We also ignore editors' files here.
.idea
.vscode
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
hub:
image: selenium/hub:3.4.0
image: selenium/hub:3.9.0
ports:
- 4444:4444
chrome:
image: selenium/node-chrome:3.4.0
image: selenium/node-chrome:3.9.0
links:
- hub
33 changes: 18 additions & 15 deletions docs/scripts/buildApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,21 @@ export default withRoot(Page);
});
}

const pagesMarkdown = findPagesMarkdown()
.map(markdown => {
const markdownSource = readFileSync(markdown.filename, 'utf8');
return {
...markdown,
components: getHeaders(markdownSource).components,
};
})
.filter(markdown => markdown.components.length > 0);

const components = findComponents(path.resolve(rootDirectory, args[2]));

components.forEach(component => {
buildDocs({ component, pagesMarkdown });
});
function run() {
const pagesMarkdown = findPagesMarkdown()
.map(markdown => {
const markdownSource = readFileSync(markdown.filename, 'utf8');
return {
...markdown,
components: getHeaders(markdownSource).components,
};
})
.filter(markdown => markdown.components.length > 0);
const components = findComponents(path.resolve(rootDirectory, args[2]));

components.forEach(component => {
buildDocs({ component, pagesMarkdown });
});
}

run();
54 changes: 27 additions & 27 deletions docs/src/modules/components/AppDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const styles = theme => ({
},
title: {
color: theme.palette.text.secondary,
marginBottom: theme.spacing.unit / 2,
'&:hover': {
color: theme.palette.primary.main,
},
Expand All @@ -38,40 +39,39 @@ const styles = theme => ({
},
});

function renderNavItems(props, pages, activePage) {
let navItems = null;

if (pages && pages.length) {
// eslint-disable-next-line no-use-before-define
navItems = pages.reduce(reduceChildRoutes.bind(null, props, activePage), []);
}

return <List>{navItems}</List>;
// eslint-disable-next-line react/prop-types
function renderNavItems({ pages, ...params }) {
return (
<List>
{pages.reduce(
// eslint-disable-next-line no-use-before-define
(items, page) => reduceChildRoutes({ items, page, ...params }),
[],
)}
</List>
);
}

function reduceChildRoutes(props, activePage, items, childPage, index) {
if (childPage.children && childPage.children.length > 1) {
const openImmediately = activePage.pathname.indexOf(childPage.pathname) === 0 || false;
function reduceChildRoutes({ props, activePage, items, page, depth }) {
if (page.children && page.children.length > 1) {
const title = pageToTitle(page);
const openImmediately = activePage.pathname.indexOf(page.pathname) === 0;

items.push(
<AppDrawerNavItem
key={index}
openImmediately={openImmediately}
title={pageToTitle(childPage)}
// Indent the nested list for Lab
{...(childPage.pathname === '/lab/api' ? { style: { paddingLeft: 18 } } : {})}
>
{renderNavItems(props, childPage.children, activePage, 0)}
<AppDrawerNavItem depth={depth} key={title} openImmediately={openImmediately} title={title}>
{renderNavItems({ props, pages: page.children, activePage, depth: depth + 1 })}
</AppDrawerNavItem>,
);
} else if (childPage.title !== false) {
childPage =
childPage.children && childPage.children.length === 1 ? childPage.children[0] : childPage;
} else if (page.title !== false) {
const title = pageToTitle(page);
page = page.children && page.children.length === 1 ? page.children[0] : page;

items.push(
<AppDrawerNavItem
key={index}
title={pageToTitle(childPage)}
href={childPage.pathname}
depth={depth}
key={title}
title={title}
href={page.pathname}
onClick={props.onClose}
/>,
);
Expand Down Expand Up @@ -105,7 +105,7 @@ function AppDrawer(props, context) {
<Divider absolute />
</Toolbar>
</div>
{renderNavItems(props, context.pages, context.activePage)}
{renderNavItems({ props, pages: context.pages, activePage: context.activePage, depth: 0 })}
</div>
);

Expand Down

0 comments on commit fca1061

Please sign in to comment.