1- import { Grid , Button , IconButton , TextField , InputLabel } from '@mui/material' ;
2- import DeleteForeverOutlinedIcon from '@mui/icons-material/DeleteForeverOutlined ' ;
1+ import { Grid , IconButton , TextField , InputLabel } from '@mui/material' ;
2+ import DeleteIcon from '@mui/icons-material/Delete ' ;
33import { FieldArrayWithId , UseFieldArrayRemove , UseFormRegister , UseFieldArrayAppend } from 'react-hook-form' ;
44import { Box } from '@mui/system' ;
5+ import { NERButton } from './NERButton' ;
56
67interface ReactHookEditableListProps {
78 name : string ;
@@ -17,21 +18,16 @@ const ReactHookEditableList: React.FC<ReactHookEditableListProps> = ({ name, ls,
1718 < >
1819 < Grid container columnSpacing = { { xs : 4 , sm : 2 , md : 3 } } >
1920 { ls . map ( ( _element , i ) => {
20- const formattedName = name
21- . split ( / (? = [ A - Z ] ) / )
22- . map ( ( name ) => name . charAt ( 0 ) . toUpperCase ( ) + name . slice ( 1 ) )
23- . join ( ' ' ) ;
24-
2521 return (
26- < Grid item xs = { 12 } md = { 6 } lg = { 4 } >
22+ < Grid item xs = { 12 } md = { 6 } lg = { 4 } key = { ` ${ name } - ${ i } ` } >
2723 < InputLabel sx = { { marginBottom : '5px' } } >
28- { bulletName ? ` ${ bulletName } ` : formattedName } { i + 1 }
24+ { bulletName } { i + 1 }
2925 </ InputLabel >
3026 < Box sx = { { display : 'flex' , alignItems : 'start' , marginBottom : '20px' } } >
3127 < TextField
3228 required
3329 autoComplete = "off"
34- placeholder = { 'Enter ' + formattedName + ' . . .' }
30+ placeholder = { 'Enter ' + bulletName + ' . . .' }
3531 sx = { { width : 12 / 12 } }
3632 multiline
3733 maxRows = { 3 }
@@ -42,21 +38,21 @@ const ReactHookEditableList: React.FC<ReactHookEditableListProps> = ({ name, ls,
4238 onClick = { ( ) => remove ( i ) }
4339 sx = { { mx : 1 , color : 'red' , marginLeft : '15px' , borderRadius : '4px' , outline : 'solid' } }
4440 >
45- < DeleteForeverOutlinedIcon />
41+ < DeleteIcon />
4642 </ IconButton >
4743 </ Box >
4844 </ Grid >
4945 ) ;
5046 } ) }
5147 </ Grid >
52- < Button
48+ < NERButton
5349 variant = "contained"
5450 color = "primary"
5551 onClick = { ( ) => append ( { bulletId : - 1 , detail : '' } ) }
5652 sx = { { width : 'max-content' , marginBottom : '40px' } }
5753 >
5854 { bulletName ? `+ Add ${ bulletName } ` : '+ Add new bullet' }
59- </ Button >
55+ </ NERButton >
6056 </ >
6157 ) ;
6258} ;
0 commit comments