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 } isLoading={ isRequesting }
rows={ rows } rows={ rows }
rowsPerPage={ totalRows } rowsPerPage={ totalRows }
showMenu={ false }
title={ title } title={ title }
totalRows={ totalRows } totalRows={ totalRows }
/> />

View File

@ -237,6 +237,7 @@ class TableCard extends Component {
rowsPerPage, rowsPerPage,
searchBy, searchBy,
searchParam, searchParam,
showMenu,
summary, summary,
title, title,
totalRows, totalRows,
@ -301,7 +302,7 @@ class TableCard extends Component {
), ),
] } ] }
menu={ 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> <MenuTitle>{ __( 'Columns:', 'wc-admin' ) }</MenuTitle>
{ allHeaders.map( ( { key, label, required } ) => { { allHeaders.map( ( { key, label, required } ) => {
if ( required ) { if ( required ) {
@ -441,6 +442,10 @@ TableCard.propTypes = {
* Url query parameter search function operates on * Url query parameter search function operates on
*/ */
searchParam: PropTypes.string, 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. * 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. * Optional, can be left off to show no summary.
@ -470,6 +475,7 @@ TableCard.defaultProps = {
query: {}, query: {},
rowHeader: 0, rowHeader: 0,
rows: [], rows: [],
showMenu: true,
}; };
export default TableCard; export default TableCard;