diff --git a/packages/patternfly-3/patternfly-react-extensions/less/patternfly-react-extensions.less b/packages/patternfly-3/patternfly-react-extensions/less/patternfly-react-extensions.less index b57dbd8a757..e38c127be74 100644 --- a/packages/patternfly-3/patternfly-react-extensions/less/patternfly-react-extensions.less +++ b/packages/patternfly-3/patternfly-react-extensions/less/patternfly-react-extensions.less @@ -1,2 +1,3 @@ @import 'filter-side-panel'; +@import 'table-grid'; diff --git a/packages/patternfly-3/patternfly-react-extensions/less/table-grid.less b/packages/patternfly-3/patternfly-react-extensions/less/table-grid.less new file mode 100644 index 00000000000..de4b81b14a0 --- /dev/null +++ b/packages/patternfly-3/patternfly-react-extensions/less/table-grid.less @@ -0,0 +1,61 @@ +.table-grid-pf { + .row, + [class*='col-'] { + overflow-x: hidden; + text-overflow: ellipsis; + vertical-align: middle; + white-space: nowrap; + } + + .table-grid-pf-body { + min-height: 50px; + position: relative; + width: 100%; + + .row { + padding: 10px 0; + } + } + + .table-grid-pf-head { + font-size: 12px; + padding: 10px 0; + } + + .table-grid-pf-column-header { + align-items: center; + display: flex; + text-transform: uppercase; + + .btn.btn-link { + color: initial; + overflow-x: hidden; + padding: 0; + text-overflow: ellipsis; + text-transform: uppercase; + white-space: nowrap; + + &:hover, + &:focus { + outline: 0; + } + } + + &.active-sort { + .btn.btn-link { + color: @link-color; + } + } + } + + .table-grid-pf-header-sort-arrow { + margin-left: 10px; + } + + &.bordered { + .table-grid-pf-head, + .table-grid-pf-body .row { + border-bottom: solid 1px #eee; + } + } +} diff --git a/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_patternfly-react-extensions.scss b/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_patternfly-react-extensions.scss index 141f6d1bc50..45d75547e96 100644 --- a/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_patternfly-react-extensions.scss +++ b/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_patternfly-react-extensions.scss @@ -2,3 +2,4 @@ Patternfly React Extensions Partials */ @import 'filter-side-panel'; +@import 'table-grid'; diff --git a/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_table-grid.scss b/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_table-grid.scss new file mode 100644 index 00000000000..8b931de530a --- /dev/null +++ b/packages/patternfly-3/patternfly-react-extensions/sass/patternfly-react-extensions/_table-grid.scss @@ -0,0 +1,61 @@ +.table-grid-pf { + .row, + [class*='col-'] { + overflow-x: hidden; + text-overflow: ellipsis; + vertical-align: middle; + white-space: nowrap; + } + + .table-grid-pf-body { + min-height: 50px; + position: relative; + width: 100%; + + .row { + padding: 10px 0; + } + } + + .table-grid-pf-head { + font-size: 12px; + padding: 10px 0; + } + + .table-grid-pf-column-header { + align-items: center; + display: flex; + text-transform: uppercase; + + .btn.btn-link { + color: initial; + overflow-x: hidden; + padding: 0; + text-overflow: ellipsis; + text-transform: uppercase; + white-space: nowrap; + + &:hover, + &:focus { + outline: 0; + } + } + + &.active-sort { + .btn.btn-link { + color: $link-color; + } + } + } + + .table-grid-pf-header-sort-arrow { + margin-left: 10px; + } + + &.bordered { + .table-grid-pf-head, + .table-grid-pf-body .row { + border-bottom: solid 1px #eee; + } + } +} diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/TableGrid.js b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/TableGrid.js new file mode 100644 index 00000000000..a2eb8813f58 --- /dev/null +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/TableGrid.js @@ -0,0 +1,41 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import classNames from 'classnames'; +import TableGridHead from './TableGridHead'; +import TableGridColumnHeader from './TableGridColumnHeader'; +import TableGridBody from './TableGridBody'; +import TableGridRow from './TableGridRow'; + +/** + * TableGrid Component for PatternFly + */ + +const TableGrid = ({ children, className, bordered, ...props }) => { + const classes = classNames('table-grid-pf', { bordered }, className); + return ( +
{MockTableGridExampleSource}+