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

View File

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