fix(striker-ui): allow OutlinedInputLabel style override

main
Tsu-ba-me 3 years ago
parent 3967fc70d0
commit 88770462ab
  1. 28
      striker-ui/components/OutlinedInputLabel/OutlinedInputLabel.tsx

@ -6,13 +6,11 @@ import {
import { BLACK, BORDER_RADIUS, GREY } from '../../lib/consts/DEFAULT_THEME'; import { BLACK, BORDER_RADIUS, GREY } from '../../lib/consts/DEFAULT_THEME';
const OutlinedInputLabel = ({ const OutlinedInputLabel = (
children, inputLabelProps: MUIInputLabelProps,
htmlFor, ): JSX.Element => {
}: MUIInputLabelProps): JSX.Element => ( const { children, sx } = inputLabelProps;
<MUIInputLabel const combinedSx = {
{...{ htmlFor }}
sx={{
color: GREY, color: GREY,
[`&.${muiInputLabelClasses.focused}`]: { [`&.${muiInputLabelClasses.focused}`]: {
@ -21,11 +19,25 @@ const OutlinedInputLabel = ({
color: BLACK, color: BLACK,
padding: '.1em .6em', padding: '.1em .6em',
}, },
...sx,
};
return (
<MUIInputLabel
// eslint-disable-next-line react/jsx-props-no-spreading
{...{
// 1. Specify default props.
variant: 'outlined',
// 2. Override defaults with given props.
...inputLabelProps,
// 3. Combine the default and given for props that can be both extended or override.
sx: combinedSx,
}} }}
variant="outlined"
> >
{children} {children}
</MUIInputLabel> </MUIInputLabel>
); );
};
export default OutlinedInputLabel; export default OutlinedInputLabel;

Loading…
Cancel
Save