Adding indicator display option to PageMenuButton.

pull/7983/head
voltron4lyfe 2 years ago committed by Qstick
parent f22a589cb8
commit 4956ff7914

@ -4,7 +4,7 @@ import { icons } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import FilterMenuContent from './FilterMenuContent';
import Menu from './Menu';
import ToolbarMenuButton from './ToolbarMenuButton';
import PageMenuButton from './PageMenuButton';
import styles from './FilterMenu.css';
class FilterMenu extends Component {
@ -60,7 +60,7 @@ class FilterMenu extends Component {
iconName={icons.FILTER}
text={translate('Filter')}
isDisabled={isDisabled}
indicator={selectedFilterKey !== 'all'}
showIndicator={selectedFilterKey !== 'all'}
/>
<FilterMenuContent
@ -106,7 +106,7 @@ FilterMenu.propTypes = {
FilterMenu.defaultProps = {
className: styles.filterMenu,
isDisabled: false,
buttonComponent: ToolbarMenuButton
buttonComponent: PageMenuButton
};
export default FilterMenu;

@ -1,13 +1,15 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import Icon from 'Components/Icon';
import MenuButton from 'Components/Menu/MenuButton';
import { icons } from 'Helpers/Props';
import styles from './PageMenuButton.css';
function PageMenuButton(props) {
const {
iconName,
indicator,
showIndicator,
text,
...otherProps
} = props;
@ -22,6 +24,22 @@ function PageMenuButton(props) {
size={18}
/>
{
showIndicator ?
<span
className={classNames(
styles.indicatorContainer,
'fa-layers fa-fw'
)}
>
<Icon
name={icons.CIRCLE}
size={9}
/>
</span> :
null
}
<div className={styles.label}>
{text}
</div>
@ -32,11 +50,11 @@ function PageMenuButton(props) {
PageMenuButton.propTypes = {
iconName: PropTypes.object.isRequired,
text: PropTypes.string,
indicator: PropTypes.bool.isRequired
showIndicator: PropTypes.bool.isRequired
};
PageMenuButton.defaultProps = {
indicator: false
showIndicator: false
};
export default PageMenuButton;

Loading…
Cancel
Save