diff --git a/src/components/DataListCell/DataListCell.jsx b/src/components/DataListCell/DataListCell.jsx new file mode 100644 index 0000000000..fdb3c984d8 --- /dev/null +++ b/src/components/DataListCell/DataListCell.jsx @@ -0,0 +1,14 @@ +import { DataListCell as PFDataListCell } from '@patternfly/react-core'; +import styled from 'styled-components'; + +const DataListCell = styled(PFDataListCell)` + display: flex; + align-items: center; + padding-bottom: ${props => (props.righthalf ? '16px' : '8px')}; + @media screen and (min-width: 768px) { + padding-bottom: 0; + justify-content: ${props => (props.lastcolumn ? 'flex-end' : 'inherit')}; + } +`; + +export default DataListCell; diff --git a/src/components/DataListCell/DataListCell.test.jsx b/src/components/DataListCell/DataListCell.test.jsx new file mode 100644 index 0000000000..55ec0b3018 --- /dev/null +++ b/src/components/DataListCell/DataListCell.test.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { mountWithContexts } from '@testUtils/enzymeHelpers'; + +import DataListCell from './DataListCell'; + +describe('DataListCell', () => { + test('renders without failing', () => { + const wrapper = mountWithContexts(); + expect(wrapper).toHaveLength(1); + }); +}); diff --git a/src/components/DataListCell/index.js b/src/components/DataListCell/index.js new file mode 100644 index 0000000000..d925b63c7d --- /dev/null +++ b/src/components/DataListCell/index.js @@ -0,0 +1 @@ +export { default } from './DataListCell'; diff --git a/src/screens/Job/JobList/JobListItem.jsx b/src/screens/Job/JobList/JobListItem.jsx index 3ec61565ce..eedf1c7d11 100644 --- a/src/screens/Job/JobList/JobListItem.jsx +++ b/src/screens/Job/JobList/JobListItem.jsx @@ -5,21 +5,12 @@ import { DataListItemRow, DataListItemCells, DataListCheck, - DataListCell as PFDataListCell, } from '@patternfly/react-core'; -import styled from 'styled-components'; +import DataListCell from '@components/DataListCell'; import VerticalSeparator from '@components/VerticalSeparator'; import { toTitleCase } from '@util/strings'; -const DataListCell = styled(PFDataListCell)` - display: flex; - align-items: center; - @media screen and (min-width: 768px) { - padding-bottom: 0; - } -`; - class JobListItem extends Component { render () { const { diff --git a/src/screens/Organization/OrganizationList/OrganizationListItem.jsx b/src/screens/Organization/OrganizationList/OrganizationListItem.jsx index 803e423a5e..ee785ba257 100644 --- a/src/screens/Organization/OrganizationList/OrganizationListItem.jsx +++ b/src/screens/Organization/OrganizationList/OrganizationListItem.jsx @@ -8,13 +8,13 @@ import { DataListItemRow, DataListItemCells, DataListCheck, - DataListCell as PFDataListCell, } from '@patternfly/react-core'; import { Link } from 'react-router-dom'; import styled from 'styled-components'; +import DataListCell from '@components/DataListCell'; import VerticalSeparator from '@components/VerticalSeparator'; import { Organization } from '@types'; @@ -38,16 +38,6 @@ const ListGroup = styled.span` } `; -const DataListCell = styled(PFDataListCell)` - display: flex; - align-items: center; - padding-bottom: ${props => (props.righthalf ? '16px' : '8px')}; - - @media screen and (min-width: 768px) { - padding-bottom: 0; - } -`; - class OrganizationListItem extends React.Component { static propTypes = { organization: Organization.isRequired, diff --git a/src/screens/Template/TemplateList/TemplateListItem.jsx b/src/screens/Template/TemplateList/TemplateListItem.jsx index 0937a0e584..c745b61a15 100644 --- a/src/screens/Template/TemplateList/TemplateListItem.jsx +++ b/src/screens/Template/TemplateList/TemplateListItem.jsx @@ -5,23 +5,13 @@ import { DataListItemRow, DataListItemCells, DataListCheck, - DataListCell as PFDataListCell, } from '@patternfly/react-core'; -import styled from 'styled-components'; -import VerticalSeparator from '@components/VerticalSeparator'; +import DataListCell from '@components/DataListCell'; import LaunchButton from '@components/LaunchButton'; +import VerticalSeparator from '@components/VerticalSeparator'; import { toTitleCase } from '@util/strings'; -const DataListCell = styled(PFDataListCell)` - display: flex; - align-items: center; - @media screen and (min-width: 768px) { - padding-bottom: 0; - justify-content: ${props => (props.lastcolumn ? 'flex-end' : 'inherit')}; - } -`; - class TemplateListItem extends Component { render () { const {