@@ -28,39 +28,41 @@ interface ICriterionEditorProps {
2828/**
2929 * Edit or delete a single criteria
3030 **/
31- const CriterionEditor = React . memo ( ( { criterion, onSave, onDelete } : ICriterionEditorProps ) => {
32- // Use react.memo to avoid rerendering the component every time a character is typed
33- const [ title , setTitle ] = useState ( criterion . title ) ;
34- const [ description , setDescription ] = useState ( criterion . description ) ;
31+ const CriterionEditor = React . memo (
32+ ( { criterion, onSave, onDelete } : ICriterionEditorProps ) => {
33+ // Use react.memo to avoid rerendering the component every time a character is typed
34+ const [ title , setTitle ] = useState ( criterion . title ) ;
35+ const [ description , setDescription ] = useState ( criterion . description ) ;
3536
36- return (
37- < Stack direction = { { sm : "column" , md : "row" } } spacing = { { xs : 1 , sm : 2 } } >
38- < TextField
39- value = { title }
40- onChange = { ( event ) => setTitle ( event . target . value ) }
41- placeholder = "title"
42- rows = { 1 }
43- />
44- < TextField
45- value = { description }
46- onChange = { ( event ) => setDescription ( event . target . value ) }
47- placeholder = "Description"
48- rows = { 1 }
49- sx = { { flex : 1 } }
50- />
51- < Button
52- fullWidth = { false }
53- variant = "contained"
54- onClick = { ( ) => onSave ( { ...criterion , title, description } ) }
55- >
56- Save
57- </ Button >
58- < Button variant = "contained" onClick = { ( ) => onDelete ( criterion ) } >
59- Delete
60- </ Button >
61- </ Stack >
62- ) ;
63- } ) ;
37+ return (
38+ < Stack direction = { { sm : "column" , md : "row" } } spacing = { { xs : 1 , sm : 2 } } >
39+ < TextField
40+ value = { title }
41+ onChange = { ( event ) => setTitle ( event . target . value ) }
42+ placeholder = "title"
43+ rows = { 1 }
44+ />
45+ < TextField
46+ value = { description }
47+ onChange = { ( event ) => setDescription ( event . target . value ) }
48+ placeholder = "Description"
49+ rows = { 1 }
50+ sx = { { flex : 1 } }
51+ />
52+ < Button
53+ fullWidth = { false }
54+ variant = "contained"
55+ onClick = { ( ) => onSave ( { ...criterion , title, description } ) }
56+ >
57+ Save
58+ </ Button >
59+ < Button variant = "contained" onClick = { ( ) => onDelete ( criterion ) } >
60+ Delete
61+ </ Button >
62+ </ Stack >
63+ ) ;
64+ } ,
65+ ) ;
6466
6567/**
6668 * A component to edit criteria for rating projects.
0 commit comments