fix(striker-ui): adjust icon size according to button size in button with menu

main
Tsu-ba-me 1 year ago
parent cee3fae024
commit 01c580c6a9
  1. 12
      striker-ui/components/ButtonWithMenu.tsx
  2. 7
      striker-ui/components/ServerMenu.tsx

@ -22,7 +22,17 @@ const ButtonWithMenu: FC<ButtonWithMenuProps> = (props) => {
const open = useMemo(() => Boolean(anchorEl), [anchorEl]); const open = useMemo(() => Boolean(anchorEl), [anchorEl]);
const buttonContent = useMemo(() => children ?? <MoreVertIcon />, [children]); const buttonContent = useMemo(() => {
if (children) {
return children;
}
if (variant === 'icon') {
return <MoreVertIcon fontSize={iconButtonProps?.size} />;
}
return 'Options';
}, [children, iconButtonProps?.size, variant]);
const buttonClickHandler = useCallback<MouseEventHandler<HTMLButtonElement>>( const buttonClickHandler = useCallback<MouseEventHandler<HTMLButtonElement>>(
(...args) => { (...args) => {

@ -1,3 +1,4 @@
import { PowerSettingsNew as PowerSettingsNewIcon } from '@mui/icons-material';
import { Box } from '@mui/material'; import { Box } from '@mui/material';
import { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
@ -131,7 +132,11 @@ const ServerMenu: FC<ServerMenuProps> = (props) => {
); );
}} }}
{...buttonWithMenuProps} {...buttonWithMenuProps}
/> >
<PowerSettingsNewIcon
fontSize={buttonWithMenuProps?.iconButtonProps?.size}
/>
</ButtonWithMenu>
{confirmDialog} {confirmDialog}
</Box> </Box>
); );

Loading…
Cancel
Save