@@ -3,7 +3,7 @@ import React from 'react';
3
3
import { useQuickForm } from '../../state/QuickFormContext' ;
4
4
import { ArrowUpIcon , ArrowDownIcon } from '../icons' ;
5
5
import { quickformtokens } from '../../style/quickFormTokensDefinition' ;
6
- import { makeStyles , mergeClasses } from "@griffel/react" ;
6
+ import { makeStyles , mergeClasses , shorthands } from "@griffel/react" ;
7
7
8
8
type NavigationButtonProps = {
9
9
className ?: string ;
@@ -12,18 +12,41 @@ type NavigationButtonProps = {
12
12
13
13
const useNavigationStyles = makeStyles ( {
14
14
button : {
15
+ width : '50px' ,
16
+ height : '100%' ,
17
+ cursor : 'pointer' ,
18
+ ...shorthands . borderWidth ( '1px' ) ,
19
+ ...shorthands . borderColor ( quickformtokens . primary ) ,
15
20
':hover' : {
16
- stroke : quickformtokens . onBackground
21
+ stroke : quickformtokens . onPrimary ,
22
+ backgroundColor : quickformtokens . primary
17
23
} ,
18
- stroke : quickformtokens . onBackground
19
24
} ,
20
25
icon : {
21
-
26
+ stroke : quickformtokens . primary ,
27
+ ':hover' : {
28
+ stroke : quickformtokens . onPrimary ,
29
+ backgroundColor : quickformtokens . primary
30
+ } ,
22
31
} ,
23
32
disabled : {
24
- stroke : quickformtokens . onBackground
25
- }
33
+ ':hover' : {
34
+ stroke : quickformtokens . primary ,
35
+ backgroundColor : 'transparent'
36
+ } ,
37
+ } ,
38
+ left : {
39
+ borderTopLeftRadius : '10px' ,
40
+ borderBottomLeftRadius : '10px' ,
41
+ ...shorthands . borderRight ( 'none' )
42
+ } ,
43
+ right : {
44
+ borderTopRightRadius : '10px' ,
45
+ borderBottomRightRadius : '10px' ,
46
+ ...shorthands . borderLeft ( 'none' )
47
+ } ,
26
48
} ) ;
49
+
27
50
export const NavigationButton : React . FC < NavigationButtonProps > = ( { className, style } ) => {
28
51
const styles = useNavigationStyles ( ) ;
29
52
@@ -34,59 +57,33 @@ export const NavigationButton: React.FC<NavigationButtonProps> = ({ className, s
34
57
35
58
const disablePrevBtn = ! state . hasPrevSlide ;
36
59
const prevLabel = disablePrevBtn ? "No previous slide" : "Go to previous" ;
37
- const rightBtnStyling = {
38
- backgroundColor : quickformtokens . background ,
39
- ...right ,
40
- ...slideNavigationButton ,
41
- }
42
60
43
61
const disableNextBtn = ! state . hasNextSlide ;
44
62
const nextLabel = disableNextBtn ? "No next slide" : "Go to next" ;
45
- const leftBtnStyling = {
46
- backgroundColor : quickformtokens . background ,
47
- ...left ,
48
- ...slideNavigationButton ,
49
- }
50
63
51
64
return (
52
65
< div className = { className } style = { style } >
53
- < label title = { prevLabel } style = { leftBtnStyling } >
54
- < button className = { styles . button }
66
+ < label title = { prevLabel } >
67
+ < button
68
+ aria-label = 'Go to previous'
69
+ className = { mergeClasses ( styles . button , styles . left , disablePrevBtn && styles . disabled ) }
55
70
disabled = { disablePrevBtn }
56
- style = { leftBtnStyling }
57
71
onClick = { goToPrevSlide }
58
72
>
59
- < ArrowUpIcon className = { mergeClasses ( styles . icon , disablePrevBtn && styles . disabled ) } />
73
+ < ArrowDownIcon className = { mergeClasses ( styles . icon , disablePrevBtn && styles . disabled ) } />
60
74
</ button >
61
75
</ label >
62
76
63
- < label title = { nextLabel } style = { rightBtnStyling } >
64
- < button className = { styles . button }
65
- disabled = { disableNextBtn }
77
+ < label title = { nextLabel } >
78
+ < button
66
79
aria-label = 'Go to next'
67
- style = { rightBtnStyling }
80
+ className = { mergeClasses ( styles . button , styles . right , disableNextBtn && styles . disabled ) }
81
+ disabled = { disableNextBtn }
68
82
onClick = { goToNextSlide }
69
83
>
70
- < ArrowDownIcon className = { mergeClasses ( styles . icon , disableNextBtn && styles . disabled ) } />
84
+ < ArrowUpIcon className = { mergeClasses ( styles . icon , disableNextBtn && styles . disabled ) } />
71
85
</ button >
72
86
</ label >
73
87
</ div >
74
88
) ;
75
- }
76
-
77
- const slideNavigationButton : React . CSSProperties = {
78
- width : '50px' ,
79
- height : '100%' ,
80
- cursor : 'pointer' ,
81
- borderWidth : '1px'
82
- } ;
83
- const left : React . CSSProperties = {
84
- borderTopLeftRadius : '10px' ,
85
- borderBottomLeftRadius : '10px' ,
86
- borderRight : 'none'
87
- } ;
88
- const right : React . CSSProperties = {
89
- borderTopRightRadius : '10px' ,
90
- borderBottomRightRadius : '10px' ,
91
- borderLeft : 'none'
92
- } ;
89
+ }
0 commit comments