Hide label option.

This commit is contained in:
Mike Cao 2021-11-04 15:55:12 -07:00
parent 99861487ea
commit a15dac05d4
2 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,7 @@ function MenuButton({
menuAlign = 'right', menuAlign = 'right',
onSelect, onSelect,
renderValue, renderValue,
hideLabel,
}) { }) {
const [showMenu, setShowMenu] = useState(false); const [showMenu, setShowMenu] = useState(false);
const ref = useRef(); const ref = useRef();
@ -44,7 +45,9 @@ function MenuButton({
onClick={toggleMenu} onClick={toggleMenu}
variant="light" variant="light"
> >
{!hideLabel && (
<div className={styles.text}>{renderValue ? renderValue(selectedOption) : value}</div> <div className={styles.text}>{renderValue ? renderValue(selectedOption) : value}</div>
)}
</Button> </Button>
{showMenu && ( {showMenu && (
<Menu <Menu

View File

@ -37,8 +37,8 @@ export default function LanguageButton() {
options={menuOptions} options={menuOptions}
value={locale} value={locale}
menuClassName={styles.menu} menuClassName={styles.menu}
renderValue={option => option?.display}
onSelect={handleSelect} onSelect={handleSelect}
hideLabel
/> />
); );
} }