File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ export const Annotator = ({
56
56
hideHeaderText,
57
57
hideNext,
58
58
hidePrev,
59
+ disabledNextAndPrev,
59
60
hideClone,
60
61
hideSettings,
61
62
hideSave,
@@ -171,6 +172,7 @@ export const Annotator = ({
171
172
hideHeaderText = { hideHeaderText }
172
173
hideNext = { hideNext }
173
174
hidePrev = { hidePrev }
175
+ disabledNextAndPrev = { disabledNextAndPrev }
174
176
hideClone = { hideClone }
175
177
hideSettings = { hideSettings }
176
178
hideSave = { hideSave }
@@ -216,6 +218,7 @@ Annotator.propTypes = {
216
218
hideHeaderText : PropTypes . bool ,
217
219
hideNext : PropTypes . bool ,
218
220
hidePrev : PropTypes . bool ,
221
+ disabledNextAndPrev : PropTypes . bool ,
219
222
hideClone : PropTypes . bool ,
220
223
hideSettings : PropTypes . bool ,
221
224
settings : PropTypes . object ,
Original file line number Diff line number Diff line change @@ -128,8 +128,6 @@ export default () => {
128
128
setLoading ( false ) ;
129
129
} , [ ] ) ;
130
130
131
-
132
-
133
131
return (
134
132
< >
135
133
{ ! showLabel ? ( // Render loading indicator if loading is true
@@ -159,6 +157,7 @@ export default () => {
159
157
changeSelectedImageIndex ( isNaN ( updatedIndex ) ? 0 : updatedIndex )
160
158
} }
161
159
hideSettings = { true }
160
+ disabledNextAndPrev = { settings . images . length <= 1 }
162
161
selectedImageIndex = { selectedImageIndex }
163
162
/> ) }
164
163
</ >
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export const MainLayout = ({
43
43
hideHeaderText,
44
44
hideNext = false ,
45
45
hidePrev = false ,
46
+ disabledNextAndPrev,
46
47
hideClone = false ,
47
48
hideSettings = false ,
48
49
downloadImage = false ,
@@ -221,8 +222,8 @@ export const MainLayout = ({
221
222
) : null ,
222
223
] . filter ( Boolean ) }
223
224
headerItems = { [
224
- ! hidePrev && { name : "Prev" } ,
225
- ! hideNext && { name : "Next" } ,
225
+ ! hidePrev && { name : "Prev" , disabled : disabledNextAndPrev } ,
226
+ ! hideNext && { name : "Next" , disabled : disabledNextAndPrev } ,
226
227
state . annotationType !== "video"
227
228
? null
228
229
: ! state . videoPlaying
Original file line number Diff line number Diff line change @@ -30,19 +30,19 @@ const ButtonInnerContent = styled("div")(({ theme }) => ({
30
30
display : "flex" ,
31
31
flexDirection : "column" ,
32
32
} ) )
33
- const IconContainer = styled ( "div" ) ( ( { textHidden } ) => ( {
34
- color : colors . grey [ 700 ] ,
33
+ const IconContainer = styled ( "div" ) ( ( { textHidden, disabled } ) => ( {
34
+ color : disabled ? colors . grey [ 400 ] : colors . grey [ 700 ] ,
35
35
height : textHidden ? 32 : 20 ,
36
36
paddingTop : textHidden ? 8 : 0 ,
37
37
"& .MuiSvgIcon-root" : {
38
38
width : 18 ,
39
39
height : 18 ,
40
40
} ,
41
41
} ) )
42
- const Text = styled ( "div" ) ( ( { theme } ) => ( {
42
+ const Text = styled ( "div" ) ( ( { theme, disabled } ) => ( {
43
43
fontWeight : "bold" ,
44
44
fontSize : 11 ,
45
- color : colors . grey [ 800 ] ,
45
+ color : disabled ? colors . grey [ 500 ] : colors . grey [ 800 ] ,
46
46
display : "flex" ,
47
47
alignItems : "center" ,
48
48
lineHeight : 1 ,
@@ -61,11 +61,11 @@ export const HeaderButton = ({
61
61
< ThemeProvider theme = { theme } >
62
62
< StyledButton onClick = { onClick } disabled = { disabled } >
63
63
< ButtonInnerContent >
64
- < IconContainer textHidden = { hideText } >
64
+ < IconContainer textHidden = { hideText } disabled = { disabled } >
65
65
{ icon || getIcon ( name , customIconMapping ) }
66
66
</ IconContainer >
67
67
{ ! hideText && (
68
- < Text >
68
+ < Text disabled = { disabled } >
69
69
< div > { name } </ div >
70
70
</ Text >
71
71
) }
You can’t perform that action at this time.
0 commit comments