fix(striker-ui): allow style overrides in IconButton; export IconButtonProps

main
Tsu-ba-me 3 years ago
parent 5fe0ec06cf
commit 3ad7ae62c8
  1. 40
      striker-ui/components/IconButton/IconButton.tsx
  2. 4
      striker-ui/components/IconButton/index.tsx

@ -1,4 +1,8 @@
import { IconButton as MUIIconButton, styled } from '@mui/material'; import { FC } from 'react';
import {
IconButton as MUIIconButton,
IconButtonProps as MUIIconButtonProps,
} from '@mui/material';
import { import {
BLACK, BLACK,
@ -7,13 +11,31 @@ import {
TEXT, TEXT,
} from '../../lib/consts/DEFAULT_THEME'; } from '../../lib/consts/DEFAULT_THEME';
const IconButton = styled(MUIIconButton)({ export type IconButtonProps = MUIIconButtonProps;
borderRadius: BORDER_RADIUS,
backgroundColor: GREY, const IconButton: FC<IconButtonProps> = ({
'&:hover': { children,
backgroundColor: TEXT, sx,
}, ...iconButtonRestProps
color: BLACK, }) => (
}); <MUIIconButton
{...{
...iconButtonRestProps,
sx: {
borderRadius: BORDER_RADIUS,
backgroundColor: GREY,
color: BLACK,
'&:hover': {
backgroundColor: TEXT,
},
...sx,
},
}}
>
{children}
</MUIIconButton>
);
export default IconButton; export default IconButton;

@ -1,3 +1,5 @@
import IconButton from './IconButton'; import IconButton, { IconButtonProps } from './IconButton';
export type { IconButtonProps };
export default IconButton; export default IconButton;

Loading…
Cancel
Save