1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Refactor MenuControls as a functional component

* Fix lint errors
This commit is contained in:
Marliana Lara 2019-07-26 13:02:57 -04:00
parent 2aa38e84dd
commit 74ef0e7abf
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
2 changed files with 26 additions and 35 deletions

View File

@ -164,7 +164,7 @@ class JobOutput extends Component {
loadMoreRows({ startIndex, stopIndex }) {
if (startIndex === 0 && stopIndex === 0) {
return;
return Promise.resolve(null);
}
const { job } = this.props;

View File

@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React from 'react';
import { Button as PFButton } from '@patternfly/react-core';
import {
PlusIcon,
@ -22,38 +22,29 @@ const Button = styled(PFButton)`
}
`;
class MenuControls extends Component {
constructor(props) {
super(props);
}
render() {
const {
onScrollTop,
onScrollBottom,
onScrollNext,
onScrollPrevious,
} = this.props;
return (
<Wrapper>
<Button variant="plain">
<PlusIcon />
</Button>
<Button onClick={onScrollPrevious} variant="plain">
<AngleUpIcon />
</Button>
<Button onClick={onScrollNext} variant="plain">
<AngleDownIcon />
</Button>
<Button onClick={onScrollTop} variant="plain">
<AngleDoubleUpIcon />
</Button>
<Button onClick={onScrollBottom} variant="plain">
<AngleDoubleDownIcon />
</Button>
</Wrapper>
);
}
}
const MenuControls = ({
onScrollTop,
onScrollBottom,
onScrollNext,
onScrollPrevious,
}) => (
<Wrapper>
<Button variant="plain">
<PlusIcon />
</Button>
<Button onClick={onScrollPrevious} variant="plain">
<AngleUpIcon />
</Button>
<Button onClick={onScrollNext} variant="plain">
<AngleDownIcon />
</Button>
<Button onClick={onScrollTop} variant="plain">
<AngleDoubleUpIcon />
</Button>
<Button onClick={onScrollBottom} variant="plain">
<AngleDoubleDownIcon />
</Button>
</Wrapper>
);
export default MenuControls;