Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/patternfly-3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/patternfly-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -23,19 +18,15 @@ 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 });
};

render() {
const { width } = this.state;
const container = (
<ChartVoronoiContainer labels={this.getTooltipLabel} />
);
const container = <ChartVoronoiContainer labels={this.getTooltipLabel} />;
const cats = {
data: {
fill: '#486b00', // global_success_color_200.value,
Expand All @@ -53,11 +44,7 @@ class CustomColorsChart extends React.Component {
return (
<div ref={this.containerRef}>
<div className="chart-overflow">
<ChartGroup
containerComponent={container}
height={100}
width={width}
>
<ChartGroup containerComponent={container} height={100} width={width}>
<ChartArea
data={[
{ name: 'Cats', x: 1, y: 1 },
Expand All @@ -69,7 +56,7 @@ class CustomColorsChart extends React.Component {
/>
<ChartArea
data={[
{ name: 'Dogs', x: 1, y: .5 },
{ name: 'Dogs', x: 1, y: 0.5 },
{ name: 'Dogs', x: 2, y: 1 },
{ name: 'Dogs', x: 3, y: 2 },
{ name: 'Dogs', x: 4, y: 2.5 },
Expand All @@ -81,9 +68,7 @@ class CustomColorsChart extends React.Component {
</div>
<ChartLegend
colorScale={[cats.data.fill, dogs.data.fill]}
data={[
{ name: 'Cats' }, { name: 'Dogs' }
]}
data={[{ name: 'Cats' }, { name: 'Dogs' }]}
title="Average number of pets"
height={50}
width={width}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React from 'react';
import {
ChartArea,
ChartGroup,
ChartLegend,
ChartTheme,
ChartVoronoiContainer
} from '@patternfly/react-charts';
import { ChartArea, ChartGroup, ChartLegend, ChartTheme, ChartVoronoiContainer } from '@patternfly/react-charts';

class DarkGreenThemeChart extends React.Component {
containerRef = React.createRef();
Expand All @@ -24,28 +18,19 @@ class DarkGreenThemeChart 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 });
};
render() {
const { width } = this.state;
const container = (
<ChartVoronoiContainer labels={this.getTooltipLabel}/>
);
const container = <ChartVoronoiContainer labels={this.getTooltipLabel} />;

return (
<div ref={this.containerRef}>
<div className="chart-overflow">
<ChartGroup
containerComponent={container}
theme={ChartTheme.dark.green}
height={100}
width={width}
>
<ChartGroup containerComponent={container} theme={ChartTheme.dark.green} height={100} width={width}>
<ChartArea
data={[
{ name: 'Cats', x: 1, y: 1 },
Expand All @@ -56,7 +41,7 @@ class DarkGreenThemeChart extends React.Component {
/>
<ChartArea
data={[
{ name: 'Dogs', x: 1, y: .5 },
{ name: 'Dogs', x: 1, y: 0.5 },
{ name: 'Dogs', x: 2, y: 1 },
{ name: 'Dogs', x: 3, y: 2 },
{ name: 'Dogs', x: 4, y: 2.5 },
Expand All @@ -66,9 +51,7 @@ class DarkGreenThemeChart extends React.Component {
</ChartGroup>
</div>
<ChartLegend
data={[
{ name: 'Cats' }, { name: 'Dogs' }
]}
data={[{ name: 'Cats' }, { name: 'Dogs' }]}
theme={ChartTheme.dark.green}
title="Average number of pets"
height={50}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 SimpleChart extends React.Component {
containerRef = React.createRef();
Expand All @@ -23,28 +18,20 @@ class SimpleChart 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 });
};

render() {
const { width } = this.state;
const container = (
<ChartVoronoiContainer labels={this.getTooltipLabel} />
);
const container = <ChartVoronoiContainer labels={this.getTooltipLabel} />;

return (
<div ref={this.containerRef}>
<div className="chart-overflow">
<ChartGroup
containerComponent={container}
height={100}
width={width}
>
<ChartGroup containerComponent={container} height={100} width={width}>
<ChartArea
data={[
{ name: 'Cats', x: 1, y: 1 },
Expand All @@ -55,7 +42,7 @@ class SimpleChart extends React.Component {
/>
<ChartArea
data={[
{ name: 'Dogs', x: 1, y: .5 },
{ name: 'Dogs', x: 1, y: 0.5 },
{ name: 'Dogs', x: 2, y: 1 },
{ name: 'Dogs', x: 3, y: 2 },
{ name: 'Dogs', x: 4, y: 2.5 },
Expand All @@ -65,9 +52,7 @@ class SimpleChart extends React.Component {
</ChartGroup>
</div>
<ChartLegend
data={[
{ name: 'Cats' }, { name: 'Dogs' }
]}
data={[{ name: 'Cats' }, { name: 'Dogs' }]}
title="Average number of pets"
height={50}
width={width}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable camelcase */
import {
global_BackgroundColor_dark_100,
global_Color_light_100
} from '@patternfly/react-tokens';
import { global_BackgroundColor_dark_100, global_Color_light_100 } from '@patternfly/react-tokens';
import { css, StyleSheet } from '@patternfly/react-styles';

const styles = StyleSheet.create({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import React from 'react';
import {
Chart,
ChartBar,
ChartGroup,
ChartTheme
} from '@patternfly/react-charts';
import {
Grid,
GridItem,
Text,
TextVariants
} from '@patternfly/react-core';
import { Chart, ChartBar, ChartGroup, ChartTheme } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';

class SimpleChart extends React.Component {
getChart = (theme) => (
<Chart
domainPadding={{ x: [30, 25] }}
theme={theme}
height={200}
width={300}
>
getChart = theme => (
<Chart domainPadding={{ x: [30, 25] }} theme={theme} height={200} width={300}>
<ChartGroup offset={11}>
<ChartBar data={[{ x: 'Cats', y: 1 }, { x: 'Dogs', y: 2 }, { x: 'Birds', y: 5 }, { x: 'Mice', y: 3 }]} />
<ChartBar data={[{ x: 'Cats', y: 2 }, { x: 'Dogs', y: 1 }, { x: 'Birds', y: 7 }, { x: 'Mice', y: 4 }]} />
Expand All @@ -33,16 +18,16 @@ class SimpleChart extends React.Component {
return (
<Grid gutter="md">
<GridItem xl={6}>
<Text className="chart-title" component={TextVariants.h2}>Blue Theme</Text>
<div className="chart-container chart-margin chart-overflow">
{this.getChart(ChartTheme.light.blue)}
</div>
<Text className="chart-title" component={TextVariants.h2}>
Blue Theme
</Text>
<div className="chart-container chart-margin chart-overflow">{this.getChart(ChartTheme.light.blue)}</div>
</GridItem>
<GridItem xl={3}>
<Text className="chart-title" component={TextVariants.h2}>Multi Color Theme</Text>
<div className="chart-container chart-margin chart-overflow">
{this.getChart(ChartTheme.light.multi)}
</div>
<Text className="chart-title" component={TextVariants.h2}>
Multi Color Theme
</Text>
<div className="chart-container chart-margin chart-overflow">{this.getChart(ChartTheme.light.multi)}</div>
</GridItem>
</Grid>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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) => (
<span>Coming soon...</span>
);
getHeatMap = theme => <span>Coming soon...</span>;

render() {
return (
<Grid gutter="md">
<GridItem xl={6}>
<Text className="chart-title" component={TextVariants.h2}>Blue Theme</Text>
<Text className="chart-title" component={TextVariants.h2}>
Blue Theme
</Text>
<div>{this.getHeatMap(ChartTheme.light.blue)}</div>
</GridItem>
<GridItem xl={3}>
<Text className="chart-title" component={TextVariants.h2}>Green Theme</Text>
<Text className="chart-title" component={TextVariants.h2}>
Green Theme
</Text>
<div>{this.getHeatMap(ChartTheme.light.multi)}</div>
</GridItem>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const propTypes = {
'': PropTypes.any
};

const Chart = ({children, ...props}) => (
const Chart = ({ children, ...props }) => (
<VictoryChart theme={ChartTheme.default} {...props}>
{children}
</VictoryChart>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@ import ChartLine from '../ChartLine/ChartLine';

Object.values([true, false]).forEach(isRead => {
test(`Chart`, () => {
const view = shallow(<Chart/>);
const view = shallow(<Chart />);
expect(view).toMatchSnapshot();
});
});

test('renders axis and component children', () => {
const view = shallow(
<Chart
minDomain={{ y: 0 }}
height={200}
width={200}
>
<Chart minDomain={{ y: 0 }} height={200} width={200}>
<ChartGroup>
<ChartLine data={[{ x: 1, y: 1 }, { x: 2, y: 2 }, { x: 3, y: 5 }, { x: 4, y: 3 }]}/>
<ChartLine data={[{ x: 1, y: 2 }, { x: 2, y: 1 }, { x: 3, y: 7 }, { x: 4, y: 4 }]}/>
<ChartLine data={[{ x: 1, y: 3 }, { x: 2, y: 4 }, { x: 3, y: 9 }, { x: 4, y: 5 }]}/>
<ChartLine data={[{ x: 1, y: 3 }, { x: 2, y: 3 }, { x: 3, y: 8 }, { x: 4, y: 7 }]}/>
<ChartLine data={[{ x: 1, y: 1 }, { x: 2, y: 2 }, { x: 3, y: 5 }, { x: 4, y: 3 }]} />
<ChartLine data={[{ x: 1, y: 2 }, { x: 2, y: 1 }, { x: 3, y: 7 }, { x: 4, y: 4 }]} />
<ChartLine data={[{ x: 1, y: 3 }, { x: 2, y: 4 }, { x: 3, y: 9 }, { x: 4, y: 5 }]} />
<ChartLine data={[{ x: 1, y: 3 }, { x: 2, y: 3 }, { x: 3, y: 8 }, { x: 4, y: 7 }]} />
</ChartGroup>
</Chart>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export const propTypes = {
};

// Note: VictoryArea.role must be hoisted
const ChartArea = (props) => (
<VictoryArea theme={ChartTheme.default} {...props}/>
);
const ChartArea = props => <VictoryArea theme={ChartTheme.default} {...props} />;
hoistNonReactStatics(ChartArea, VictoryArea);
ChartArea.propTypes = propTypes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ChartArea from '../ChartArea/ChartArea';

Object.values([true, false]).forEach(isRead => {
test(`Chart`, () => {
const view = shallow(<ChartArea/>);
const view = shallow(<ChartArea />);
expect(view).toMatchSnapshot();
});
});
Expand Down
Loading