fix(striker-ui): allow OutlinedInputLabel style override

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

@ -6,26 +6,38 @@ 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 }} color: GREY,
sx={{
color: GREY,
[`&.${muiInputLabelClasses.focused}`]: { [`&.${muiInputLabelClasses.focused}`]: {
backgroundColor: GREY, backgroundColor: GREY,
borderRadius: BORDER_RADIUS, borderRadius: BORDER_RADIUS,
color: BLACK, color: BLACK,
padding: '.1em .6em', padding: '.1em .6em',
}, },
}}
variant="outlined" ...sx,
> };
{children}
</MUIInputLabel> 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,
}}
>
{children}
</MUIInputLabel>
);
};
export default OutlinedInputLabel; export default OutlinedInputLabel;

Loading…
Cancel
Save