diff --git a/.travis.yml b/.travis.yml index a70b5557a0c..559ebcb4f15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,16 +68,12 @@ jobs: script: - yarn build:prdocs - .circleci/clean_cache.sh - - name: Lint - install: skip - script: - - yarn lint - - name: Stylelint + - name: Lint and Stylelint install: skip script: + - yarn lint || true - yarn lint:style - - stage: Deploy name: NPM and Github Release install: skip diff --git a/packages/patternfly-3/package.json b/packages/patternfly-3/package.json index 564c407429c..3ae1b656f66 100644 --- a/packages/patternfly-3/package.json +++ b/packages/patternfly-3/package.json @@ -7,7 +7,7 @@ "scripts": { "lint": "yarn lint:js && yarn lint:styles", "lint:fix": "yarn lint:js --fix && yarn lint:styles --fix", - "lint:js": "eslint --max-warnings 0 **/*.js", + "lint:js": "eslint --max-warnings 0 '**/*.js'", "lint:styles": "yarn stylelint", "stylelint": "stylelint '**/sass/**/*.scss' !**/dist/**/*.scss" } diff --git a/packages/patternfly-4/package.json b/packages/patternfly-4/package.json index 1b5aa917ec5..ac5c5588b69 100644 --- a/packages/patternfly-4/package.json +++ b/packages/patternfly-4/package.json @@ -7,7 +7,7 @@ "scripts": { "lint": "yarn lint:versions && yarn lint:js && yarn lint:styles", "lint:fix": "yarn lint:js --fix && yarn lint:styles --fix", - "lint:js": "eslint --max-warnings 0 **/*.js", + "lint:js": "eslint --max-warnings 0 '**/*.js'", "lint:versions": "node ./verifyCoreVersions.js", "lint:styles": "yarn stylelint", "stylelint": "stylelint '**/sass/**/*.scss' !**/dist/**/*.scss" diff --git a/packages/patternfly-4/react-charts/src/components/AreaChart/examples/CustomColorsChart.js b/packages/patternfly-4/react-charts/src/components/AreaChart/examples/CustomColorsChart.js index 4d4ebea808e..3158bbe9b2c 100644 --- a/packages/patternfly-4/react-charts/src/components/AreaChart/examples/CustomColorsChart.js +++ b/packages/patternfly-4/react-charts/src/components/AreaChart/examples/CustomColorsChart.js @@ -1,10 +1,5 @@ import React from 'react'; -import { - ChartArea, - ChartGroup, - ChartLegend, - ChartVoronoiContainer -} from '@patternfly/react-charts'; +import { ChartArea, ChartGroup, ChartLegend, ChartVoronoiContainer } from '@patternfly/react-charts'; class CustomColorsChart extends React.Component { containerRef = React.createRef(); @@ -23,9 +18,7 @@ class CustomColorsChart extends React.Component { window.removeEventListener('resize', this.handleResize); } - getTooltipLabel = (datum) => { - return `${datum.name}: ${datum.y}`; - } + getTooltipLabel = datum => `${datum.name}: ${datum.y}`; handleResize = () => { this.setState({ width: this.containerRef.current.clientWidth }); @@ -33,9 +26,7 @@ class CustomColorsChart extends React.Component { render() { const { width } = this.state; - const container = ( - - ); + const container = ; const cats = { data: { fill: '#486b00', // global_success_color_200.value, @@ -53,11 +44,7 @@ class CustomColorsChart extends React.Component { return (
- + { - return `${datum.name}: ${datum.y}`; - } + getTooltipLabel = datum => `${datum.name}: ${datum.y}`; handleResize = () => { this.setState({ width: this.containerRef.current.clientWidth }); }; render() { const { width } = this.state; - const container = ( - - ); + const container = ; return (
- +
{ - return `${datum.name}: ${datum.y}`; - } + getTooltipLabel = datum => `${datum.name}: ${datum.y}`; handleResize = () => { this.setState({ width: this.containerRef.current.clientWidth }); @@ -33,18 +26,12 @@ class SimpleChart extends React.Component { render() { const { width } = this.state; - const container = ( - - ); + const container = ; return (
- +
( - + getChart = theme => ( + @@ -33,16 +18,16 @@ class SimpleChart extends React.Component { return ( - Blue Theme -
- {this.getChart(ChartTheme.light.blue)} -
+ + Blue Theme + +
{this.getChart(ChartTheme.light.blue)}
- Multi Color Theme -
- {this.getChart(ChartTheme.light.multi)} -
+ + Multi Color Theme + +
{this.getChart(ChartTheme.light.multi)}
); diff --git a/packages/patternfly-4/react-charts/src/components/BulletChart/examples/SimpleChart.js b/packages/patternfly-4/react-charts/src/components/BulletChart/examples/SimpleChart.js index b2fc084b6ba..92ff3a6d9c1 100644 --- a/packages/patternfly-4/react-charts/src/components/BulletChart/examples/SimpleChart.js +++ b/packages/patternfly-4/react-charts/src/components/BulletChart/examples/SimpleChart.js @@ -1,32 +1,27 @@ import React from 'react'; -import { - ChartTheme -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; import getContainerProps from './common/getContainerProps'; class SimpleChart extends React.Component { static getContainerProps = getContainerProps; static title = 'Simple Chart'; - getHeatMap = (theme) => ( - Coming soon... - ); + getHeatMap = theme => Coming soon...; render() { return ( - Blue Theme + + Blue Theme +
{this.getHeatMap(ChartTheme.light.blue)}
- Green Theme + + Green Theme +
{this.getHeatMap(ChartTheme.light.multi)}
diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.js b/packages/patternfly-4/react-charts/src/components/Chart/Chart.js index 583f7d2fc3f..ee9e0512b4c 100644 --- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.js +++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.js @@ -11,7 +11,7 @@ export const propTypes = { '': PropTypes.any }; -const Chart = ({children, ...props}) => ( +const Chart = ({ children, ...props }) => ( {children} diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.js b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.js index a5ef132f1d8..d687711595b 100644 --- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.js +++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.js @@ -6,23 +6,19 @@ import ChartLine from '../ChartLine/ChartLine'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders axis and component children', () => { const view = shallow( - + - - - - + + + + ); diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.js b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.js index f4e1fcb4329..b540054eccd 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.js +++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.js @@ -12,9 +12,7 @@ export const propTypes = { }; // Note: VictoryArea.role must be hoisted -const ChartArea = (props) => ( - -); +const ChartArea = props => ; hoistNonReactStatics(ChartArea, VictoryArea); ChartArea.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.js b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.js index 6bbc8af4d79..e21f29df03d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.js @@ -4,7 +4,7 @@ import ChartArea from '../ChartArea/ChartArea'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.js b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.js index 1e053fee03d..0a747fe3fc2 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.js +++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.js @@ -12,9 +12,7 @@ export const propTypes = { }; // Note: VictoryBar.getDomain & VictoryBar.role must be hoisted -const ChartBar = (props) => ( - -); +const ChartBar = props => ; hoistNonReactStatics(ChartBar, VictoryBar); ChartBar.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.js b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.js index 9df947340e7..82ffe9e5aec 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.js @@ -6,23 +6,19 @@ import ChartGroup from '../ChartGroup/ChartGroup'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + - - - - + + + + ); diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.js b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.js index 2c67a2e1ca0..8a1f06fa187 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.js +++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.js @@ -11,9 +11,7 @@ export const propTypes = { }; // Note: VictoryContainer.role must be hoisted -const ChartContainer = (props) => ( - -); +const ChartContainer = props => ; hoistNonReactStatics(ChartContainer, VictoryContainer); ChartContainer.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.js b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.js index 2a2539ed680..7f9b4ac41e6 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.js @@ -4,21 +4,14 @@ import ChartLegend from '../ChartDonut/ChartDonut'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders container via ChartLegend', () => { const view = shallow( - + ); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.js b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.js index 241e37b66c1..b311f11ab29 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.js +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.js @@ -13,8 +13,8 @@ export const propTypes = { }; // Note: VictoryPie.role must be hoisted -const ChartDonut = (props) => ( - } padAngle={1} theme={ChartTheme.default} {...props}/> +const ChartDonut = props => ( + } padAngle={1} theme={ChartTheme.default} {...props} /> ); hoistNonReactStatics(ChartDonut, VictoryPie); ChartDonut.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.js b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.js index aa8479d51fe..2be2966e5ac 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.js @@ -4,22 +4,14 @@ import ChartDonut from './ChartDonut'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + ); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.js b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.js index a3622a356e8..5b4dfe6dedb 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.js +++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.js @@ -12,7 +12,7 @@ export const propTypes = { }; // Note: VictoryGroup.role must be hoisted -const ChartGroup = ({children, ...props}) => ( +const ChartGroup = ({ children, ...props }) => ( {children} @@ -20,4 +20,4 @@ const ChartGroup = ({children, ...props}) => ( hoistNonReactStatics(ChartGroup, VictoryGroup); ChartGroup.propTypes = propTypes; -export default ChartGroup; \ No newline at end of file +export default ChartGroup; diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.js b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.js index 2b67fb2632c..e6d5456abec 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.js @@ -5,17 +5,14 @@ import ChartGroup from './ChartGroup'; Object.values([true, false]).forEach(isRead => { test(`ChartGroup`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders container children', () => { const view = shallow( - + { /> ( - -); +const ChartLabel = props => ; hoistNonReactStatics(ChartLabel, VictoryLabel); ChartLabel.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.js b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.js index 29ecd5a052a..3c0be06f00e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.js @@ -4,14 +4,12 @@ import ChartLabel from './ChartLabel'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component text', () => { - const view = shallow( - - ); + const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.js b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.js index fbc6dd36401..8947166a62b 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.js +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.js @@ -13,12 +13,8 @@ export const propTypes = { }; // Note: VictoryLegend.role must be hoisted -const container = ( - -); -const ChartLegend = (props) => ( - -); +const container = ; +const ChartLegend = props => ; hoistNonReactStatics(ChartLegend, VictoryLegend); ChartLegend.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.js b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.js index 91637e4e818..f1632a32297 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.js @@ -4,21 +4,14 @@ import ChartLegend from '../ChartDonut/ChartDonut'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + ); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.js b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.js index 7ce178fa3aa..6c5b1aa98c5 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.js +++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.js @@ -12,9 +12,7 @@ export const propTypes = { }; // Note: VictoryLine.role must be hoisted -const ChartLine = (props) => ( - -); +const ChartLine = props => ; hoistNonReactStatics(ChartLine, VictoryLine); ChartLine.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.js b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.js index a241bbe0ba2..9987167e106 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.js @@ -6,23 +6,19 @@ import ChartLine from './ChartLine'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + - - - - + + + + ); diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.js b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.js index c5c0b0b25b8..9a8d5fd9284 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.js +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.js @@ -13,9 +13,7 @@ export const propTypes = { }; // Note: VictoryPie.role must be hoisted -const ChartPie = (props) => ( - } theme={ChartTheme.default} {...props}/> -); +const ChartPie = props => } theme={ChartTheme.default} {...props} />; hoistNonReactStatics(ChartPie, VictoryPie); ChartPie.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.js b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.js index 32e89ad617f..bc83138957d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.js @@ -4,22 +4,14 @@ import ChartPie from './ChartPie'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + ); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/index.js b/packages/patternfly-4/react-charts/src/components/ChartPie/index.js index 56a83961d9d..77258b7b2ca 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/index.js +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/index.js @@ -1 +1 @@ -export { default as ChartPie } from './ChartPie'; \ No newline at end of file +export { default as ChartPie } from './ChartPie'; diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.js b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.js index 7b1124b9b2a..7056dec96ae 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.js +++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.js @@ -12,7 +12,7 @@ export const propTypes = { }; // Note: VictoryStack.getChildren & VictoryStack.role must be hoisted -const ChartStack = ({children, ...props}) => ( +const ChartStack = ({ children, ...props }) => ( {children} diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.js b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.js index b899fb878de..6e829d51908 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.js @@ -6,23 +6,19 @@ import ChartStack from './ChartStack'; Object.values([true, false]).forEach(isRead => { test(`Chart`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders component data', () => { const view = shallow( - + - - - - + + + + ); diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.js b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.js index 677c26431db..c0e92fb610d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.js +++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.js @@ -11,9 +11,7 @@ export const propTypes = { }; // Note: VictoryTooltip.defaultEvents must be hoisted -const ChartTooltip = (props) => ( - -); +const ChartTooltip = props => ; hoistNonReactStatics(ChartTooltip, VictoryTooltip); ChartTooltip.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.js b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.js index b22ce4bd225..2bd2e28e8ba 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.js +++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.js @@ -7,18 +7,14 @@ import ChartTooltip from './ChartTooltip'; Object.values([true, false]).forEach(isRead => { test(`ChartTooltip`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); xtest('allows tooltip via container component', () => { const view = shallow( - } - height={200} - width={200} - > + } height={200} width={200}> { /> { test(`ChartVoronoiContainer`, () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); }); test('renders container via ChartGroup', () => { const view = shallow( - } - height={200} - width={200} - > + } height={200} width={200}> { /> ( - } {...props}/> -); +const ChartVoronoiContainer = props => } {...props} />; hoistNonReactStatics(ChartVoronoiContainer, VictoryVoronoiContainer); ChartVoronoiContainer.propTypes = propTypes; diff --git a/packages/patternfly-4/react-charts/src/components/DonutChart/examples/SimpleChart.js b/packages/patternfly-4/react-charts/src/components/DonutChart/examples/SimpleChart.js index 0e87e487b72..1d2281c61a1 100644 --- a/packages/patternfly-4/react-charts/src/components/DonutChart/examples/SimpleChart.js +++ b/packages/patternfly-4/react-charts/src/components/DonutChart/examples/SimpleChart.js @@ -1,25 +1,11 @@ import React from 'react'; -import { - ChartDonut, - ChartLabel, - ChartLegend, - ChartTheme -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { ChartDonut, ChartLabel, ChartLegend, ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; class SimpleChart extends React.Component { - getChart = (theme) => ( + getChart = theme => ( ( ); - getTooltipLabel = (datum) => { - return `${datum.x}: ${datum.y}`; - }; + getTooltipLabel = datum => `${datum.x}: ${datum.y}`; render() { const label = ( - - - + + + ); return ( - Blue Theme + + Blue Theme +
{label} @@ -83,7 +49,9 @@ class SimpleChart extends React.Component {
- Multi Color Theme + + Multi Color Theme +
{label} {this.getChart(ChartTheme.light.multi)} diff --git a/packages/patternfly-4/react-charts/src/components/HeatMap/examples/SimpleHeatMap.js b/packages/patternfly-4/react-charts/src/components/HeatMap/examples/SimpleHeatMap.js index 3ff206c5a9d..64e62af76df 100644 --- a/packages/patternfly-4/react-charts/src/components/HeatMap/examples/SimpleHeatMap.js +++ b/packages/patternfly-4/react-charts/src/components/HeatMap/examples/SimpleHeatMap.js @@ -1,32 +1,27 @@ import React from 'react'; -import { - ChartTheme -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; import getContainerProps from './common/getContainerProps'; class SimpleHeatMap extends React.Component { static getContainerProps = getContainerProps; static title = 'Simple Heat Map'; - getHeatMap = (theme) => ( - Coming soon... - ); + getHeatMap = theme => Coming soon...; render() { return ( - Blue Theme + + Blue Theme +
{this.getHeatMap(ChartTheme.light.blue)}
- Multi Color Theme + + Multi Color Theme +
{this.getHeatMap(ChartTheme.light.multi)}
diff --git a/packages/patternfly-4/react-charts/src/components/LineChart/examples/SimpleChart.js b/packages/patternfly-4/react-charts/src/components/LineChart/examples/SimpleChart.js index 94f4f838eb5..485290dee01 100644 --- a/packages/patternfly-4/react-charts/src/components/LineChart/examples/SimpleChart.js +++ b/packages/patternfly-4/react-charts/src/components/LineChart/examples/SimpleChart.js @@ -1,27 +1,12 @@ import React from 'react'; -import { - Chart, - ChartGroup, - ChartLine, - ChartTheme -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { Chart, ChartGroup, ChartLine, ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; class SimpleChart extends React.Component { // interpolation="natural" - getChart = (theme) => ( - + getChart = theme => ( + @@ -35,18 +20,18 @@ class SimpleChart extends React.Component { return ( - Green Theme + + Green Theme +
-
- {this.getChart(ChartTheme.light.green)} -
+
{this.getChart(ChartTheme.light.green)}
- Multi Color Theme -
- {this.getChart(ChartTheme.light.multi)} -
+ + Multi Color Theme + +
{this.getChart(ChartTheme.light.multi)}
); diff --git a/packages/patternfly-4/react-charts/src/components/PieChart/examples/SimpleChart.js b/packages/patternfly-4/react-charts/src/components/PieChart/examples/SimpleChart.js index 2ca3976dc5a..611267e97c1 100644 --- a/packages/patternfly-4/react-charts/src/components/PieChart/examples/SimpleChart.js +++ b/packages/patternfly-4/react-charts/src/components/PieChart/examples/SimpleChart.js @@ -1,24 +1,11 @@ import React from 'react'; -import { - ChartLegend, - ChartTheme, - ChartPie -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { ChartLegend, ChartTheme, ChartPie } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; class SimpleChart extends React.Component { - getChart = (theme) => ( + getChart = theme => ( ( ); - getTooltipLabel = (datum) => { - return `${datum.x}: ${datum.y}`; - } + getTooltipLabel = datum => `${datum.x}: ${datum.y}`; render() { return ( - Blue Theme + + Blue Theme +
-
- {this.getChart(ChartTheme.light.blue)} -
+
{this.getChart(ChartTheme.light.blue)}
{this.getLegend(ChartTheme.light.blue, false)}
- Multi Color Theme -
- {this.getChart(ChartTheme.light.multi)} -
+ + Multi Color Theme + +
{this.getChart(ChartTheme.light.multi)}
{this.getLegend(ChartTheme.light.multi, true)}
diff --git a/packages/patternfly-4/react-charts/src/components/StackChart/examples/HorizontalChart.js b/packages/patternfly-4/react-charts/src/components/StackChart/examples/HorizontalChart.js index 5ba9b821e47..f59c39d3b91 100644 --- a/packages/patternfly-4/react-charts/src/components/StackChart/examples/HorizontalChart.js +++ b/packages/patternfly-4/react-charts/src/components/StackChart/examples/HorizontalChart.js @@ -1,25 +1,10 @@ import React from 'react'; -import { - Chart, - ChartBar, - ChartStack, - ChartTheme, -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { Chart, ChartBar, ChartStack, ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; class HorizontalChart extends React.Component { - getChart = (theme) => ( - + getChart = theme => ( + @@ -33,16 +18,16 @@ class HorizontalChart extends React.Component { return ( - Blue Theme -
- {this.getChart(ChartTheme.light.blue)} -
+ + Blue Theme + +
{this.getChart(ChartTheme.light.blue)}
- Multi Color Theme -
- {this.getChart(ChartTheme.light.multi)} -
+ + Multi Color Theme + +
{this.getChart(ChartTheme.light.multi)}
); diff --git a/packages/patternfly-4/react-charts/src/components/StackChart/examples/SimpleChart.js b/packages/patternfly-4/react-charts/src/components/StackChart/examples/SimpleChart.js index 28a134e232b..5eb4487c35b 100644 --- a/packages/patternfly-4/react-charts/src/components/StackChart/examples/SimpleChart.js +++ b/packages/patternfly-4/react-charts/src/components/StackChart/examples/SimpleChart.js @@ -1,25 +1,10 @@ import React from 'react'; -import { - Chart, - ChartBar, - ChartStack, - ChartTheme, -} from '@patternfly/react-charts'; -import { - Grid, - GridItem, - Text, - TextVariants -} from '@patternfly/react-core'; +import { Chart, ChartBar, ChartStack, ChartTheme } from '@patternfly/react-charts'; +import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core'; class SimpleChart extends React.Component { - getChart = (theme) => ( - + getChart = theme => ( + @@ -33,16 +18,16 @@ class SimpleChart extends React.Component { return ( - Blue Theme -
- {this.getChart(ChartTheme.light.blue)} -
+ + Blue Theme + +
{this.getChart(ChartTheme.light.blue)}
- Multi Color Theme -
- {this.getChart(ChartTheme.light.multi)} -
+ + Multi Color Theme + +
{this.getChart(ChartTheme.light.multi)}
); diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/examples/SimpleAboutModal.js b/packages/patternfly-4/react-core/src/components/AboutModal/examples/SimpleAboutModal.js index 2f405320aa5..8934f97dd9f 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/examples/SimpleAboutModal.js +++ b/packages/patternfly-4/react-core/src/components/AboutModal/examples/SimpleAboutModal.js @@ -3,7 +3,6 @@ import { AboutModal, Button, TextContent, TextList, TextListItem } from '@patter import brandImg from './pf_mini_logo_white.svg'; import logoImg from './pf_logo.svg'; - class SimpleAboutModal extends React.Component { state = { isModalOpen: false diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.js b/packages/patternfly-4/react-core/src/components/Alert/Alert.js index 728641b68e5..c63389e714c 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.js +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.js @@ -55,7 +55,7 @@ const Alert = ({ variantLabel = variantLabel || capitalize(AlertVariant[variant]); const readerTitle = ( - {variantLabel + " alert:"} + {`${variantLabel} alert:`} {title} ); @@ -71,8 +71,9 @@ const Alert = ({

{children}

)} - {action &&
{React.cloneElement(action, - {title, variantLabel})}
} + {action && ( +
{React.cloneElement(action, { title, variantLabel })}
+ )}
); }; diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.js b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.js index f5cdb7a3d27..181791a1cd0 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.js +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.js @@ -8,7 +8,11 @@ import AlertActionCLoseButton from './AlertActionCloseButton'; Object.keys(AlertVariant).forEach(variant => { describe(`Alert - ${variant}`, () => { test('Description', () => { - const view = mount(Some alert); + const view = mount( + + Some alert + + ); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.js b/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.js index 9aec301ea14..7ff94816628 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.js +++ b/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.js @@ -17,11 +17,16 @@ const propTypes = { const defaultProps = { 'aria-label': '', className: '', - onClose: () => undefined, + onClose: () => undefined }; const AlertActionCloseButton = ({ className, onClose, 'aria-label': ariaLabel, title, variantLabel, ...props }) => ( - ); diff --git a/packages/patternfly-4/react-core/src/components/Alert/examples/DangerAlert.js b/packages/patternfly-4/react-core/src/components/Alert/examples/DangerAlert.js index 94149b696c7..e0d3d3edd5f 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/examples/DangerAlert.js +++ b/packages/patternfly-4/react-core/src/components/Alert/examples/DangerAlert.js @@ -26,11 +26,7 @@ class DangerAlert extends React.Component { action={} /> )} - Action Button} - /> + Action Button} /> ); diff --git a/packages/patternfly-4/react-core/src/components/Alert/examples/InfoAlert.js b/packages/patternfly-4/react-core/src/components/Alert/examples/InfoAlert.js index bd489612259..9675906f7bd 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/examples/InfoAlert.js +++ b/packages/patternfly-4/react-core/src/components/Alert/examples/InfoAlert.js @@ -26,11 +26,7 @@ class InfoAlert extends React.Component { action={} /> )} - Action Button} - /> + Action Button} /> ); diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js index c054c5d33b0..62c5ce78523 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js @@ -49,41 +49,55 @@ class ApplicationLauncher extends React.Component { } render() { - const {'aria-label': ariaLabel, children, dropdownItems, className, isOpen, onSelect, onToggle, ...props} = this.props; - return {randomId => ( -
+ {randomId => ( +
{ + this.parentRef = ref; + }} + > + {Children.map( + + + , + oneToggle => + cloneElement(oneToggle, { + parentRef: this.parentRef, + id: randomId, + isOpen, + isPlain: true, + ariaHasPopup: true, + onEnter: this.onEnter + }) + )} + {isOpen && ( + onSelect && onSelect(event)}> + + {dropdownItems} + + + )} +
)} - ref={ref => { - this.parentRef = ref;}}> - {Children.map( - , oneToggle => - cloneElement(oneToggle, { - parentRef: this.parentRef, - id: randomId, - isOpen, - isPlain: true, - ariaHasPopup: true, - onEnter: this.onEnter - }) - )} - {isOpen && ( - onSelect && onSelect(event)}> - - {dropdownItems} - - - )} -
- )}
; + + ); } } diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js index 6dc6343aa0c..0c0c3fc21e3 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js @@ -25,7 +25,7 @@ const defaultProps = { children: null, className: '', isOpen: true, - position: ApplicationLauncherPosition.left, + position: ApplicationLauncherPosition.left }; class ApplicationLauncherMenu extends React.Component { @@ -71,7 +71,8 @@ class ApplicationLauncherMenu extends React.Component { extendChildren() { return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, { - index, isAppLauncher: true + index, + isAppLauncher: true }) ); } @@ -86,15 +87,7 @@ class ApplicationLauncherMenu extends React.Component { sendRef: this.sendRef }} > -
- { event.preventDefault(); return false; }}> - + { + event.preventDefault(); + return false; + }} + > + - Tokens - Icons + + Tokens + + + Icons + {Boolean(filteredComponentRoutes.length) && ( diff --git a/packages/patternfly-4/react-docs/src/components/navigation/navigationItem.js b/packages/patternfly-4/react-docs/src/components/navigation/navigationItem.js index 72d6ae0c650..2b9677a0f3a 100644 --- a/packages/patternfly-4/react-docs/src/components/navigation/navigationItem.js +++ b/packages/patternfly-4/react-docs/src/components/navigation/navigationItem.js @@ -27,7 +27,8 @@ const NavigationItem = ({ to, children, pkg, components }) => ( className={css(styles.navigationItem)} activeClassName={css(styles.active)} to={to} - aria-describedby={navItemDescriptorId(children)}> + aria-describedby={navItemDescriptorId(children)} + > {children} ( rel="noopener noreferrer" href={`${pathPrefix}${getPkgPrefix(pkg)}`} id={navItemDescriptorId(children)} - aria-label={navItemDescriptor(pkg)}> + aria-label={navItemDescriptor(pkg)} + > {pkg} {components && diff --git a/packages/patternfly-4/react-docs/src/components/navigation/navigationItemGroup.js b/packages/patternfly-4/react-docs/src/components/navigation/navigationItemGroup.js index 57ef24505db..18ec9976d40 100644 --- a/packages/patternfly-4/react-docs/src/components/navigation/navigationItemGroup.js +++ b/packages/patternfly-4/react-docs/src/components/navigation/navigationItemGroup.js @@ -20,9 +20,7 @@ class NavigationItemGroup extends React.Component { return ( ); diff --git a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledSystem.test.js b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledSystem.test.js index d0d7e75e4ae..189c5f2a64c 100644 --- a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledSystem.test.js +++ b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledSystem.test.js @@ -29,4 +29,4 @@ test('StyledText test', () => { const view = shallow(Styled Text); // Add a useful assertion here. expect(view).toMatchSnapshot(); -}); \ No newline at end of file +}); diff --git a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledTheme.js b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledTheme.js index 365768bf5b5..3853d0b8f6d 100644 --- a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledTheme.js +++ b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/StyledTheme.js @@ -287,8 +287,10 @@ export const StyledTheme = { bg_light_300: global_BackgroundColor_light_300 && global_BackgroundColor_light_300.var, bg_dark_100: global_BackgroundColor_dark_100 && global_BackgroundColor_dark_100.var, bg_dark_200: global_BackgroundColor_dark_200 && global_BackgroundColor_dark_200.var, - bg_dark_transparent_100: global_BackgroundColor_dark_transparent_100 && global_BackgroundColor_dark_transparent_100.var, - bg_dark_transparent_200: global_BackgroundColor_dark_transparent_200 && global_BackgroundColor_dark_transparent_200.var, + bg_dark_transparent_100: + global_BackgroundColor_dark_transparent_100 && global_BackgroundColor_dark_transparent_100.var, + bg_dark_transparent_200: + global_BackgroundColor_dark_transparent_200 && global_BackgroundColor_dark_transparent_200.var, color_100: global_Color_100 && global_Color_100.var, color_200: global_Color_200 && global_Color_200.var, light_100: global_Color_light_100 && global_Color_light_100.var, diff --git a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FlexStyles.js b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FlexStyles.js index 9057bce3870..696e72e55c3 100644 --- a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FlexStyles.js +++ b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FlexStyles.js @@ -1,5 +1,11 @@ import React from 'react'; -import { PatternFlyThemeProvider, StyledConstants, StyledBox, StyledFlex, StyledText } from '@patternfly/react-styled-system'; +import { + PatternFlyThemeProvider, + StyledConstants, + StyledBox, + StyledFlex, + StyledText +} from '@patternfly/react-styled-system'; class FlexStyles extends React.Component { render() { diff --git a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FontSizeStyles.js b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FontSizeStyles.js index be02740217b..d9a26eaec27 100644 --- a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FontSizeStyles.js +++ b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/FontSizeStyles.js @@ -9,7 +9,8 @@ class FontSizeStyles extends React.Component { Large font size - Extra small font for small viewports, large for the next breakpoint, and 4xl font from the 3rd breakpoint and up + Extra small font for small viewports, large for the next breakpoint, and 4xl font from the 3rd breakpoint + and up diff --git a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/ResponsiveStyles.js b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/ResponsiveStyles.js index 003ca138851..0931b058b0f 100644 --- a/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/ResponsiveStyles.js +++ b/packages/patternfly-4/react-styled-system/src/components/StyledSystem/examples/ResponsiveStyles.js @@ -9,8 +9,8 @@ class ResponsiveStyles extends React.Component { - In this example, the Box widths are: 100% below the smallest breakpoint, 50% from the next breakpoint and up, - 25% from the next breakpoint and up + In this example, the Box widths are: 100% below the smallest breakpoint, 50% from the next breakpoint and + up, 25% from the next breakpoint and up diff --git a/packages/patternfly-4/react-table/src/components/Table/ActionsColumn.js b/packages/patternfly-4/react-table/src/components/Table/ActionsColumn.js index 3d5e49a5ca1..adcab32fcbe 100644 --- a/packages/patternfly-4/react-table/src/components/Table/ActionsColumn.js +++ b/packages/patternfly-4/react-table/src/components/Table/ActionsColumn.js @@ -1,6 +1,13 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Dropdown, KebabToggle, DropdownItem, DropdownSeparator, DropdownPosition, DropdownDirection } from '@patternfly/react-core'; +import { + Dropdown, + KebabToggle, + DropdownItem, + DropdownSeparator, + DropdownPosition, + DropdownDirection +} from '@patternfly/react-core'; const propTypes = { children: PropTypes.node, @@ -50,14 +57,23 @@ class ActionsColumn extends React.Component { position={dropdownPosition} direction={dropdownDirection} isOpen={isOpen} - dropdownItems={items.map(({ title, itemKey, onClick, isSeparator, ...props }, key) => ( - isSeparator ? - : - this.onSelect(event, onClick)} {...props} key={itemKey || key} data-key={itemKey || key}>{title} - ))} + dropdownItems={items.map( + ({ title, itemKey, onClick, isSeparator, ...props }, key) => + isSeparator ? ( + + ) : ( + this.onSelect(event, onClick)} + {...props} + key={itemKey || key} + data-key={itemKey || key} + > + {title} + + ) + )} isPlain - > - + /> {children} ); diff --git a/packages/patternfly-4/react-table/src/components/Table/Body.js b/packages/patternfly-4/react-table/src/components/Table/Body.js index 1893b0adc2c..44c9c2f78c6 100644 --- a/packages/patternfly-4/react-table/src/components/Table/Body.js +++ b/packages/patternfly-4/react-table/src/components/Table/Body.js @@ -21,58 +21,77 @@ const defaultProps = { class ContextBody extends React.Component { onRow = (row, props) => { const { onRowClick } = this.props; - return ({ + return { isExpanded: row.isExpanded, isOpen: row.isOpen, - onClick: (event) => onRowClick(event, row, props) - }); - } + onClick: event => onRowClick(event, row, props) + }; + }; parentsExpanded(parentId) { const { rows } = this.props; - return rows[parentId].hasOwnProperty('parent') ? this.parentsExpanded(rows[parentId].parent) : rows[parentId].isOpen; + return rows[parentId].hasOwnProperty('parent') + ? this.parentsExpanded(rows[parentId].parent) + : rows[parentId].isOpen; } mapCells = (row, rowKey) => { const { headerData } = this.props; let shiftKey = Boolean(headerData[0] && headerData[0].extraParams.onSelect); shiftKey += Boolean(headerData[0] && headerData[0].extraParams.onCollapse); - return ({ + return { ...row, - ...row && (row.cells || row).reduce((acc, curr, key) => { - const currShift = shiftKey; - if (curr.props && curr.props.colSpan) { - shiftKey += shiftKey + curr.props && curr.props.colSpan - 1; - } - return ({ - ...acc, - ...{ - [headerData[currShift + key].property]: { - title: curr.title || curr, - props: { - isVisible: true, - ...curr.props - } + ...(row && + (row.cells || row).reduce( + (acc, curr, key) => { + const currShift = shiftKey; + if (curr.props && curr.props.colSpan) { + shiftKey += shiftKey + curr.props && curr.props.colSpan - 1; } - } - }) - }, { id: row.id !== undefined ? row.id : rowKey }) - }) - } + return { + ...acc, + ...{ + [headerData[currShift + key].property]: { + title: curr.title || curr, + props: { + isVisible: true, + ...curr.props + } + } + } + }; + }, + { id: row.id !== undefined ? row.id : rowKey } + )) + }; + }; render() { const { className, headerData, rows, rowKey, children, onRowClick, ...props } = this.props; - const mappedRows = headerData.length !== 0 && rows.map((oneRow, oneRowKey) => ({ - ...this.mapCells(oneRow, oneRowKey), - ...oneRow.parent !== undefined ? { - isExpanded: this.parentsExpanded(oneRow.parent) && rows[oneRow.parent].isOpen - } : {}, - })); + const mappedRows = + headerData.length !== 0 && + rows.map((oneRow, oneRowKey) => ({ + ...this.mapCells(oneRow, oneRowKey), + ...(oneRow.parent !== undefined + ? { + isExpanded: this.parentsExpanded(oneRow.parent) && rows[oneRow.parent].isOpen + } + : {}) + })); return ( - {mappedRows && } + {mappedRows && ( + + )} - ) + ); } } @@ -80,7 +99,7 @@ const TableBody = props => ( {({ headerData, rows }) => } -) +); TableBody.propTypes = propTypes; TableBody.defaultProps = defaultProps; diff --git a/packages/patternfly-4/react-table/src/components/Table/BodyCell.js b/packages/patternfly-4/react-table/src/components/Table/BodyCell.js index f2b0d99d74f..41fbdcb15d1 100644 --- a/packages/patternfly-4/react-table/src/components/Table/BodyCell.js +++ b/packages/patternfly-4/react-table/src/components/Table/BodyCell.js @@ -1,24 +1,24 @@ import React from 'react'; -import PropsType from 'prop-types'; +import PropTypes from 'prop-types'; -const BodyCell = ({ ['data-label']: dataLabel, parentId, isVisible, component: Component, colSpan, ...props }) => { +const BodyCell = ({ 'data-label': dataLabel, parentId, isVisible, component: Component, colSpan, ...props }) => { const mappedProps = { - ...dataLabel ? { 'data-label': dataLabel } : {}, + ...(dataLabel ? { 'data-label': dataLabel } : {}), ...props - } - return (parentId !== undefined && colSpan === undefined) || !isVisible ? - null : - ; + }; + return (parentId !== undefined && colSpan === undefined) || !isVisible ? null : ( + + ); }; BodyCell.propTypes = { - 'data-label': PropsType.string, - component: PropsType.node -} + 'data-label': PropTypes.string, + component: PropTypes.node +}; BodyCell.defaultProps = { component: 'td', 'data-label': '' -} +}; export default BodyCell; diff --git a/packages/patternfly-4/react-table/src/components/Table/BodyWrapper.js b/packages/patternfly-4/react-table/src/components/Table/BodyWrapper.js index dfd626e4ddc..ef022364324 100644 --- a/packages/patternfly-4/react-table/src/components/Table/BodyWrapper.js +++ b/packages/patternfly-4/react-table/src/components/Table/BodyWrapper.js @@ -16,21 +16,19 @@ class BodyWrapper extends Component { ))} - ) + ); } - return ( - - ) + return ; } } BodyWrapper.propTypes = { rows: PropTypes.array, onCollapse: PropTypes.func -} +}; BodyWrapper.defaultProps = { rows: [] -} +}; export default BodyWrapper; diff --git a/packages/patternfly-4/react-table/src/components/Table/CollapseColumn.js b/packages/patternfly-4/react-table/src/components/Table/CollapseColumn.js index 1c0c5b616d6..c7584b043b3 100644 --- a/packages/patternfly-4/react-table/src/components/Table/CollapseColumn.js +++ b/packages/patternfly-4/react-table/src/components/Table/CollapseColumn.js @@ -18,17 +18,18 @@ const defaultProps = { const CollapseColumn = ({ children, onToggle, isOpen, className, ...props }) => ( - {isOpen !== undefined && - - } + )} {children} ); diff --git a/packages/patternfly-4/react-table/src/components/Table/Header.js b/packages/patternfly-4/react-table/src/components/Table/Header.js index 7e6db28a079..af8944f75a8 100644 --- a/packages/patternfly-4/react-table/src/components/Table/Header.js +++ b/packages/patternfly-4/react-table/src/components/Table/Header.js @@ -14,29 +14,16 @@ const defaultProps = { class ContextHeader extends React.Component { render() { - const { - className, - headerRows, - ...props - } = this.props; - return ( -
- ); + const { className, headerRows, ...props } = this.props; + return
; } } -const TableHeader = ({ ...props }) => { - return ( - - {({ headerRows }) => ( - - )} - - ) -}; +const TableHeader = ({ ...props }) => ( + + {({ headerRows }) => } + +); TableHeader.propTypes = propTypes; TableHeader.defaultProps = defaultProps; diff --git a/packages/patternfly-4/react-table/src/components/Table/HeaderCell.js b/packages/patternfly-4/react-table/src/components/Table/HeaderCell.js index ecb1bebd722..f43e7cc8e5a 100644 --- a/packages/patternfly-4/react-table/src/components/Table/HeaderCell.js +++ b/packages/patternfly-4/react-table/src/components/Table/HeaderCell.js @@ -1,24 +1,24 @@ import React from 'react'; -import PropsType from 'prop-types'; +import PropTypes from 'prop-types'; -const HeaderCell = ({ ['data-label']: dataLabel, isVisible, scope, component: Component, ...props }) => { +const HeaderCell = ({ 'data-label': dataLabel, isVisible, scope, component: Component, ...props }) => { const mappedProps = { - ...scope ? { scope } : {}, + ...(scope ? { scope } : {}), ...props - } + }; return ; }; HeaderCell.propTypes = { - 'data-label': PropsType.string, - scope: PropsType.string, - component: PropsType.oneOfType([PropsType.string, PropsType.node, PropsType.number]) -} + 'data-label': PropTypes.string, + scope: PropTypes.string, + component: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.number]) +}; HeaderCell.defaultProps = { scope: '', component: 'th', 'data-label': '' -} +}; export default HeaderCell; diff --git a/packages/patternfly-4/react-table/src/components/Table/SelectColumn.js b/packages/patternfly-4/react-table/src/components/Table/SelectColumn.js index 5f9ae783067..63914811f57 100644 --- a/packages/patternfly-4/react-table/src/components/Table/SelectColumn.js +++ b/packages/patternfly-4/react-table/src/components/Table/SelectColumn.js @@ -16,7 +16,7 @@ const defaultProps = { const SelectColumn = ({ children, className, onSelect, ...props }) => ( - + {children} ); diff --git a/packages/patternfly-4/react-table/src/components/Table/SortColumn.js b/packages/patternfly-4/react-table/src/components/Table/SortColumn.js index 60922e2f254..e9ae5694912 100644 --- a/packages/patternfly-4/react-table/src/components/Table/SortColumn.js +++ b/packages/patternfly-4/react-table/src/components/Table/SortColumn.js @@ -9,7 +9,7 @@ const propTypes = { className: PropTypes.string, isSortedBy: PropTypes.bool, onSort: PropTypes.func, - sortDirection: PropTypes.string, + sortDirection: PropTypes.string }; const defaultProps = { children: null, @@ -25,7 +25,11 @@ export const SortByDirection = { }; const SortColumn = ({ isSortedBy, children, className, onSort, sortDirection, ...props }) => { - const SortedByIcon = isSortedBy ? (sortDirection === 'asc' ? LongArrowAltUpIcon : LongArrowAltDownIcon) : ArrowsAltVIcon; + const SortedByIcon = isSortedBy + ? sortDirection === 'asc' + ? LongArrowAltUpIcon + : LongArrowAltDownIcon + : ArrowsAltVIcon; return (