Add showMenu prop to TableCard to hide ellipsis menu (https://github.com/woocommerce/woocommerce-admin/pull/1296)

* Add showMenu prop to TableCard to hide ellipsis menu

* Fix proptype description
This commit is contained in:
Joshua T Flowers 2019-01-15 10:13:15 +08:00 committed by GitHub
parent 14f8f08edf
commit 4b3df7732b
2 changed files with 8 additions and 1 deletions

View File

@ -57,6 +57,7 @@ export class Leaderboard extends Component {
isLoading={ isRequesting }
rows={ rows }
rowsPerPage={ totalRows }
showMenu={ false }
title={ title }
totalRows={ totalRows }
/>

View File

@ -237,6 +237,7 @@ class TableCard extends Component {
rowsPerPage,
searchBy,
searchParam,
showMenu,
summary,
title,
totalRows,
@ -301,7 +302,7 @@ class TableCard extends Component {
),
] }
menu={
<EllipsisMenu label={ __( 'Choose which values to display', 'wc-admin' ) }>
showMenu && <EllipsisMenu label={ __( 'Choose which values to display', 'wc-admin' ) }>
<MenuTitle>{ __( 'Columns:', 'wc-admin' ) }</MenuTitle>
{ allHeaders.map( ( { key, label, required } ) => {
if ( required ) {
@ -441,6 +442,10 @@ TableCard.propTypes = {
* Url query parameter search function operates on
*/
searchParam: PropTypes.string,
/**
* Boolean to determine whether or not ellipsis menu is shown.
*/
showMenu: PropTypes.bool,
/**
* An array of objects with `label` & `value` properties, which display in a line under the table.
* Optional, can be left off to show no summary.
@ -470,6 +475,7 @@ TableCard.defaultProps = {
query: {},
rowHeader: 0,
rows: [],
showMenu: true,
};
export default TableCard;