File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ import { TextField } from '../../base/TextField' ;
2+ import { styled } from '@mui/material/styles' ;
3+ import type { TextFieldProps } from '../../base/TextField' ;
4+
5+ export const StyledTextField = styled ( TextField ) ( ( { theme } ) => ( {
6+ '& .MuiOutlinedInput-root' : {
7+ backgroundColor : theme . palette . background . paper ,
8+ '& fieldset' : {
9+ borderColor : 'theme.palette.background.brand.default' ,
10+ borderWidth : 1 ,
11+ } ,
12+ '&:hover fieldset' : {
13+ borderColor : 'theme.palette.background.brand.default' ,
14+ borderWidth : 2 ,
15+ } ,
16+ '&.Mui-focused fieldset' : {
17+ borderColor : 'theme.palette.background.brand.default' ,
18+ borderWidth : 2 ,
19+ borderLeftWidth : 4 ,
20+ padding : '4px' ,
21+ } ,
22+ } ,
23+ '& .MuiInputLabel-root' : {
24+ color : theme . palette . text . secondary ,
25+ '&.Mui-focused' : {
26+ color : 'theme.palette.background.brand.default' ,
27+ } ,
28+ } ,
29+ '& .MuiInputLabel-asterisk' : {
30+ display : 'none' ,
31+ } ,
32+ '& .MuiInputBase-input' : {
33+ color : theme . palette . common . black ,
34+ } ,
35+ } ) ) ;
36+
37+ interface CustomTextFieldProps extends Omit < TextFieldProps , 'variant' | 'size' > {
38+ minWidth ?: number ;
39+ variant ?: 'outlined' | 'filled' | 'standard' ;
40+ size ?: 'small' | 'medium' ;
41+ }
42+
43+ export const CustomTextField = ( {
44+ minWidth = 150 ,
45+ variant = 'outlined' ,
46+ size = 'small' ,
47+ ...props
48+ } : CustomTextFieldProps ) : JSX . Element => {
49+ return (
50+ < StyledTextField
51+ variant = { variant }
52+ size = { size }
53+ sx = { { minWidth } }
54+ { ...props }
55+ />
56+ ) ;
57+ } ;
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export {
6868export { SetupPreReq } from './SetupPrerequisite' ;
6969export { StyledChapter } from './StyledChapter' ;
7070export { StyledSearchBar } from './StyledSearchBar' ;
71+ export { CustomTextField } from './StyledTextField' ;
7172export { Terminal } from './Terminal' ;
7273export { TOC } from './TOCChapter' ;
7374export { TOCLearning } from './TOCLearning' ;
You can’t perform that action at this time.
0 commit comments