Enhance MenuButton component in WindowAppMenu
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Added a new `logo` prop to the `MenuButton` component to conditionally adjust padding and margin based on the presence of a logo. - Updated the `MenuButton` prop types to include the new `logo` boolean, improving flexibility in rendering menu items with logos.
This commit is contained in:
parent
557c334aa0
commit
7d79e0d206
@ -49,7 +49,7 @@ const mapSidebarItemsToMenuItems = (items = [], navigate) =>
|
|||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
const MenuButton = ({ label, items }) => (
|
const MenuButton = ({ label, items, logo }) => (
|
||||||
<Dropdown menu={{ items }} trigger={['click']} placement='bottomLeft'>
|
<Dropdown menu={{ items }} trigger={['click']} placement='bottomLeft'>
|
||||||
<Button
|
<Button
|
||||||
type='text'
|
type='text'
|
||||||
@ -57,7 +57,8 @@ const MenuButton = ({ label, items }) => (
|
|||||||
className='electrobun-webkit-app-region-no-drag'
|
className='electrobun-webkit-app-region-no-drag'
|
||||||
style={{
|
style={{
|
||||||
height: '28px',
|
height: '28px',
|
||||||
paddingInline: '8px',
|
paddingInline: logo ? '6px' : '8px',
|
||||||
|
marginRight: logo ? '1px' : '0',
|
||||||
fontWeight: 500
|
fontWeight: 500
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -68,7 +69,8 @@ const MenuButton = ({ label, items }) => (
|
|||||||
|
|
||||||
MenuButton.propTypes = {
|
MenuButton.propTypes = {
|
||||||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
||||||
items: PropTypes.array.isRequired
|
items: PropTypes.array.isRequired,
|
||||||
|
logo: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const WindowAppMenu = () => {
|
const WindowAppMenu = () => {
|
||||||
@ -233,6 +235,7 @@ const WindowAppMenu = () => {
|
|||||||
return (
|
return (
|
||||||
<MenuButton
|
<MenuButton
|
||||||
key={menu.key}
|
key={menu.key}
|
||||||
|
logo={true}
|
||||||
label={
|
label={
|
||||||
<FarmControlLogoSmall
|
<FarmControlLogoSmall
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user