fix(striker-ui): customize MUI text field

main
Tsu-ba-me 3 years ago
parent 554a94a9ad
commit 387222ebdb
  1. 45
      striker-ui/components/Files/FileInfo.tsx

@ -4,6 +4,7 @@ import {
FormControl, FormControl,
FormControlLabel, FormControlLabel,
inputClasses, inputClasses,
inputLabelClasses,
MenuItem, MenuItem,
outlinedInputClasses, outlinedInputClasses,
Select, Select,
@ -15,7 +16,14 @@ import {
SyncDisabled as SyncDisabledIcon, SyncDisabled as SyncDisabledIcon,
} from '@mui/icons-material'; } from '@mui/icons-material';
import { BLUE, GREY, RED, TEXT } from '../../lib/consts/DEFAULT_THEME'; import {
BLUE,
BORDER_RADIUS,
GREY,
RED,
TEXT,
UNSELECTED,
} from '../../lib/consts/DEFAULT_THEME';
import { UPLOAD_FILE_TYPES_ARRAY } from '../../lib/consts/UPLOAD_FILE_TYPES'; import { UPLOAD_FILE_TYPES_ARRAY } from '../../lib/consts/UPLOAD_FILE_TYPES';
type FileInfoProps = Pick<FileDetailMetadata, 'fileName' | 'fileLocations'> & type FileInfoProps = Pick<FileDetailMetadata, 'fileName' | 'fileLocations'> &
@ -30,12 +38,41 @@ const FILE_INFO_DEFAULT_PROPS: Partial<FileInfoProps> = {
}; };
const StyledTextField = styled(TextField)({ const StyledTextField = styled(TextField)({
[`& .${outlinedInputClasses.root}`]: { [`& .${inputLabelClasses.root}`]: {
color: GREY, color: GREY,
[`&.${inputClasses.focused}`]: {
backgroundColor: BLUE,
borderRadius: BORDER_RADIUS,
color: TEXT,
padding: '.1em .6em',
},
}, },
[`& .${inputClasses.focused}`]: { [`& .${outlinedInputClasses.root}`]: {
color: TEXT, color: GREY,
[`& .${outlinedInputClasses.notchedOutline}`]: {
borderColor: UNSELECTED,
},
'&:hover': {
[`& .${outlinedInputClasses.notchedOutline}`]: {
borderColor: GREY,
},
},
[`&.${inputClasses.focused}`]: {
color: TEXT,
[`& .${outlinedInputClasses.notchedOutline}`]: {
borderColor: BLUE,
'& legend': {
paddingRight: '1.2em',
},
},
},
}, },
}); });

Loading…
Cancel
Save