File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed
src/components/CompareResults Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import FormControl from '@mui/material/FormControl';
6
6
import TextField from '@mui/material/TextField' ;
7
7
8
8
interface EditTitleInputProps {
9
- compact : boolean ;
10
9
value : string ;
11
10
refInput : React . RefObject < HTMLInputElement > ;
12
11
onCancel : ( ) => unknown ;
@@ -15,14 +14,12 @@ interface EditTitleInputProps {
15
14
}
16
15
17
16
function EditTitleInput ( {
18
- compact,
19
17
value,
20
18
refInput,
21
19
onChange,
22
20
onSave,
23
21
onCancel,
24
22
} : EditTitleInputProps ) {
25
- const size = compact ? 'small' : undefined ;
26
23
const inputPlaceholder = 'Write a title for this comparison' ;
27
24
const [ titleError , setTitleError ] = useState ( false ) ;
28
25
const titleErrorMsg = 'Title cannot be empty' ;
@@ -41,12 +38,11 @@ function EditTitleInput({
41
38
} , [ onCancel ] ) ;
42
39
43
40
const onSaveSubmit = ( e : React . FormEvent ) => {
41
+ e . preventDefault ( ) ;
44
42
if ( ! value . trim ( ) ) {
45
- e . preventDefault ( ) ;
46
43
setTitleError ( true ) ;
47
44
return ;
48
45
}
49
- e . preventDefault ( ) ;
50
46
onSave ( ) ;
51
47
} ;
52
48
@@ -74,7 +70,7 @@ function EditTitleInput({
74
70
setTitleError ( false ) ;
75
71
onChange ( e . target . value ) ;
76
72
} }
77
- size = { size }
73
+ size = 'small'
78
74
className = 'edit-results-title-text-field'
79
75
error = { titleError }
80
76
value = { value }
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ function ResultsMain() {
102
102
const [ comparisonTitleName , setComparisonTitleName ] = useState (
103
103
initialComparisonTitle ,
104
104
) ;
105
- const previousComparisonTitleRef = useRef ( 'Results' ) ;
105
+ const previousComparisonTitleRef = useRef ( initialComparisonTitle ) ;
106
106
const editTitleInputRef = useRef < HTMLInputElement > ( null ) ;
107
107
const [ editComparisonTitleInputVisible , showEditComparisonTitleInput ] =
108
108
useState ( false ) ;
@@ -148,7 +148,6 @@ function ResultsMain() {
148
148
{ editComparisonTitleInputVisible ? (
149
149
< EditTitleInput
150
150
refInput = { editTitleInputRef }
151
- compact = { true }
152
151
onChange = { onComparisonTitleChange }
153
152
onSave = { onSaveButtonClick }
154
153
onCancel = { onCancelButtonClick }
You can’t perform that action at this time.
0 commit comments