Skip to content

Commit

Permalink
feat(workspace): use new doc theme (patternfly#4840)
Browse files Browse the repository at this point in the history
* replace gatsby-theme-patternfly-org with theme-patternfly-org

* add fullscreen screenshots

* bump theme

* move bulk selection guidelines back to patternfly-org

* fix CI

* fix lint

* fix divider

* fix icon imports

* save ~5s/reload

* fix notification badge css
  • Loading branch information
redallen authored Sep 22, 2020
1 parent 9548ea3 commit 7bf451d
Show file tree
Hide file tree
Showing 51 changed files with 2,748 additions and 4,797 deletions.
39 changes: 9 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ references:
- packages/react-virtualized-extension/dist/
- packages/react-catalog-view-extension/dist/
- packages/react-icons/dist/
gatsby_cache_paths: &gatsby_cache_paths
webpack_cache_paths: &webpack_cache_paths
- packages/react-docs/.cache
- packages/react-docs/public
lint_cache_paths: &lint_cache_paths
- .eslintcache
js_deps_cache_key: &js_deps_cache_key
Expand All @@ -50,24 +49,6 @@ references:
attach_workspace: &attach_workspace
attach_workspace:
at: ~/project
install_node: &install_node
run:
name: Install node@12 (need right version for `yarn`)
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v12
nvm alias default v12
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
install_yarn: &install_yarn
run:
name: Install yarn
command: curl -o- -L https://yarnpkg.com/install.sh | bash
workflows:
version: 2
build_test_deploy:
Expand All @@ -88,9 +69,9 @@ workflows:
- test_integration:
requires:
- build_demo_app
- test_a11y_pf4:
requires:
- build_docs_pf4
# - test_a11y_pf4:
# requires:
# - build_docs_pf4
- deploy_prerelease:
requires:
- lint_pf4
Expand Down Expand Up @@ -229,8 +210,8 @@ jobs:
fi
when: always
build_docs_pf4:
machine:
image: circleci/classic:latest
docker:
- image: circleci/node:12
steps:
- *attach_workspace
- restore_cache:
Expand All @@ -239,20 +220,18 @@ jobs:
- restore_cache:
keys:
- *gatsby_cache_key
- *install_node
- *install_yarn
- run:
name: Build patternfly-react docs
command: ~/.yarn/bin/yarn build:docs
command: yarn build:docs
- save_cache:
paths: *gatsby_cache_paths
paths: *webpack_cache_paths
key: *gatsby_cache_key
- run:
name: Upload docs to surge.sh
command: node .circleci/upload-preview.js packages/react-docs/public
- persist_to_workspace:
root: ~/project
paths: *gatsby_cache_paths
paths: *webpack_cache_paths
test_a11y_pf4:
docker:
- image: circleci/node:12-browsers
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"prettier": "node node_modules/.bin/prettier --write \"packages/**/*.{js,jsx,ts,tsx}\" \"scripts/**/*.{js,jsx,ts,tsx}\"",
"serve:docs": "lerna run serve",
"serve:integration": "lerna run serve:demo-app",
"start": "concurrently --kill-others \"yarn build && yarn watch\" \"yarn workspace @patternfly/react-docs develop\"",
"start": "yarn build && concurrently --kill-others \"yarn watch\" \"yarn workspace @patternfly/react-docs develop\"",
"start:cypress": "lerna run cypress:open",
"start:demo-app": "lerna run start:demo-app --stream",
"start:pf4": "yarn start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
getInteractiveLegendEvents,
getInteractiveLegendItemStyles
} from '@patternfly/react-charts';
import { chart_area_Opacity, chart_color_black_500 } from '@patternfly/react-tokens';
import chart_area_Opacity from '@patternfly/react-tokens/dist/js/chart_area_Opacity';
import chart_color_black_500 from '@patternfly/react-tokens/dist/js/chart_color_black_500';

## Introduction
Note: PatternFly React charts live in its own package at [@patternfly/react-charts](https://www.npmjs.com/package/@patternfly/react-charts)!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cssPrefix: pf-c-divider
propComponents: ['Divider']
---

## Examples
### Using hr (default)
```js
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class DropdownMenu extends React.Component<DropdownMenuProps> {
children:
(group.props.children.constructor === Array &&
React.Children.map(
group.props.children as React.ReactElement<any>,
(group.props.children as unknown) as React.ReactElement<any>,
(option: React.ReactElement<any>) =>
React.cloneElement(option, {
index: index++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SimpleNotificationBadge extends React.Component {
render() {
const { unreadVariant, attentionVariant } = this.state;
return (
<div className='pf-t-dark'>
<div className="pf-t-dark">
<NotificationBadge variant={unreadVariant} onClick={this.onFirstClick} aria-label="First notifications" />
<NotificationBadge variant={attentionVariant} onClick={this.onSecondClick} aria-label="Second notifications" />
</div>
Expand Down Expand Up @@ -76,7 +76,7 @@ class NotificationBadgeWithCount extends React.Component {
render() {
const { firstVariant, firstCount, secondVariant, secondCount } = this.state;
return (
<div className='pf-t-dark'>
<div className="pf-t-dark">
<NotificationBadge variant={firstVariant} onClick={this.onFirstClick} aria-label="First notifications" count={firstCount} />
<NotificationBadge variant={secondVariant} onClick={this.onSecondClick} aria-label="Second notifications" count={secondCount} />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ws-react-c-notificationbadge-basic,
#ws-react-c-notificationbadge-with-count{
#ws-react-c-notification-badge-basic,
#ws-react-c-notification-badge-with-count{
background-color: var(--pf-global--BackgroundColor--dark-100);
}
Empty file.
5 changes: 4 additions & 1 deletion packages/react-docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ static/base.css
.DS_Store

# Old build files
**/ts-output.json
**/ts-output.json

# Files from theme-patternfly-org
src/generated/**/*.js
2 changes: 1 addition & 1 deletion packages/react-docs/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ Packages released:
- Fixed group select options in single variant ([#3838](https://github.com/patternfly/patternfly-react/pull/3838))
- Allowed count badge to be hidden in checkbox select ([#3976](https://github.com/patternfly/patternfly-react/pull/3976))
- Added logic for disabled default options for typeahead ([#3895](https://github.com/patternfly/patternfly-react/pull/3895))
## Table
### Table
- Fixed forward ref types ([#3919](https://github.com/patternfly/patternfly-react/pull/3919))
- Added column management demo ([#3942](https://github.com/patternfly/patternfly-react/pull/3942))

Expand Down
100 changes: 0 additions & 100 deletions packages/react-docs/gatsby-config.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/react-docs/gatsby-node.js

This file was deleted.

24 changes: 9 additions & 15 deletions packages/react-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
"author": "Red Hat",
"license": "MIT",
"scripts": {
"build:docs": "yarn build:static && yarn build:ram",
"build:ram": "node --max-old-space-size=8192 ./node_modules/.bin/gatsby build",
"build:static": "shx cp -r ../react-core/dist/styles/* static",
"clean": "rimraf .cache public static/assets static/base.css",
"clean:mdx": "rimraf .cache/caches/gatsby-mdx",
"develop": "gatsby develop",
"serve": "gatsby serve",
"test:a11y": "patternfly-a11y --file .cache/fullscreenPages.json --prefix http://localhost:9000 --aggregate --noIncomplete --ignore color-contrast,focusable-content,scrollable-region-focusable --skip \"charts|virtualizedtable/selectable\""
"analyze": "yarn build:docs --analyze",
"build:docs": "yarn theme-patternfly-org build all",
"clean": "rimraf .cache public static/assets static/base.css src/generated/**/*.js",
"develop": "theme-patternfly-org start",
"serve": "serve public",
"screenshots": "theme-patternfly-org screenshots --urlPrefix http://localhost:5000"
},
"dependencies": {
"@patternfly/patternfly": "4.42.2",
Expand All @@ -36,19 +34,15 @@
"@patternfly/react-virtualized-extension": "^4.5.79"
},
"devDependencies": {
"@mdx-js/mdx": "^1.1.5",
"@mdx-js/react": "^1.1.5",
"@patternfly/patternfly-a11y": "^0.0.17",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"gatsby": "2.21.0",
"gatsby-theme-patternfly-org": "^4.2.6",
"gatsby-transformer-react-docgen-typescript": "^4.0.5",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.1",
"rimraf": "^2.6.3",
"shx": "^0.3.2"
"serve": "^11.3.2",
"shx": "^0.3.2",
"theme-patternfly-org": "^0.1.17"
},
"keywords": [
"gatsby"
Expand Down
18 changes: 18 additions & 0 deletions packages/react-docs/patternfly-docs.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This module is shared between NodeJS and babelled ES5
module.exports = {
pathPrefix: '',
hasGdprBanner: false,
hasFooter: false,
hasVersionSwitcher: false,
hasDesignGuidelines: false,
sideNavItems: [
{ section: 'get-started' },
{ section: 'charts' },
{ section: 'components' },
{ section: 'demos' },
{ section: 'extensions' },
{ section: 'layouts' }
],
topNavItems: [{ text: 'Icons', path: '/icons' }],
port: 8002
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '@patternfly/react-styles/src/css/components/Topology/topology-view.css';
import '@patternfly/react-styles/src/css/layouts/Toolbar/toolbar.css';

// Global theme CSS
import 'gatsby-theme-patternfly-org/global.css';
import 'theme-patternfly-org/global.css';

// Patternfly
import '@patternfly/patternfly/patternfly.css';
Expand Down
16 changes: 16 additions & 0 deletions packages/react-docs/patternfly-docs.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This module is shared between NodeJS and babelled ES5
const isClient = Boolean(process.env.NODE_ENV);

module.exports = {
'/': {
SyncComponent: isClient && require('./src/pages/index').default
},
'/icons': {
Component: () => import(/* webpackChunkName: "icons/index" */ './src/pages/icons'),
title: 'Icons'
},
'/404': {
SyncComponent: isClient && require('theme-patternfly-org/pages/404').default,
title: '404 Error'
}
};
33 changes: 33 additions & 0 deletions packages/react-docs/patternfly-docs.source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const path = require('path');

module.exports = (sourceMD, sourceProps) => {
// Theme pages
const themePagesPath = require.resolve('theme-patternfly-org/package.json').replace('package.json', 'pages');
sourceMD(path.join(themePagesPath, '*.md'), 'pages-overview');

// React props
const reactCorePath = require.resolve('@patternfly/react-core/package.json').replace('package.json', 'src');
const reactTablePath = require.resolve('@patternfly/react-table/package.json').replace('package.json', 'src');
const reactChartsPath = require.resolve('@patternfly/react-charts/package.json').replace('package.json', 'src');
const reactPropsIgnore = '**/*.test.tsx';
sourceProps(path.join(reactCorePath, '/**/*.tsx'), reactPropsIgnore);
sourceProps(path.join(reactTablePath, '/**/*.tsx'), reactPropsIgnore);
sourceProps(path.join(reactChartsPath, '/**/*.tsx'), reactPropsIgnore);

// React MD
sourceMD(path.join(reactCorePath, '/**/examples/*.md'), 'react');
sourceMD(path.join(reactCorePath, '/**/demos/**/*.md'), 'react');

// React-table MD
sourceMD(path.join(reactTablePath, '/**/examples/*.md'), 'react');
sourceMD(path.join(reactTablePath, '/**/demos/*.md'), 'react');

// Charts MD (no demos yet)
sourceMD(path.join(reactChartsPath, '/**/examples/*.md'), 'react');

// Release notes
sourceMD(require.resolve('@patternfly/react-docs/RELEASE-NOTES.md'), 'react');

// Upgrade guide
sourceMD(require.resolve('@patternfly/react-docs/UPGRADE-GUIDE.md'), 'react');
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7bf451d

Please sign in to comment.