@@ -4,29 +4,34 @@ import { colors } from '../../../config.json';
4
4
import { CellDisabledContext } from './Container' ;
5
5
import { CellSectionContext } from './Section' ;
6
6
7
- interface IStyledCellButtonProps {
7
+ interface IStyledCellButtonProps extends React . HTMLAttributes < HTMLButtonElement > {
8
8
selected ?: boolean ;
9
9
containedInSection : boolean ;
10
10
}
11
11
12
- const StyledCellButton = styled . button ( { } , ( props : IStyledCellButtonProps ) => ( {
13
- display : 'flex' ,
14
- padding : '0 16px 0 22px' ,
15
- marginBottom : '1px' ,
16
- flex : 1 ,
17
- alignItems : 'center' ,
18
- alignContent : 'center' ,
19
- cursor : 'default' ,
20
- border : 'none' ,
21
- backgroundColor : props . selected
12
+ export const StyledCellButton = styled . button ( { } , ( props : IStyledCellButtonProps ) => {
13
+ const backgroundColor = props . selected
22
14
? colors . green
23
15
: props . containedInSection
24
16
? colors . blue40
25
- : colors . blue ,
26
- ':not(:disabled):hover' : {
27
- backgroundColor : props . selected ? colors . green : colors . blue80 ,
28
- } ,
29
- } ) ) ;
17
+ : colors . blue ;
18
+ const backgroundColorHover = props . selected ? colors . green : colors . blue80 ;
19
+
20
+ return {
21
+ display : 'flex' ,
22
+ padding : '0 16px 0 22px' ,
23
+ marginBottom : '1px' ,
24
+ flex : 1 ,
25
+ alignItems : 'center' ,
26
+ alignContent : 'center' ,
27
+ cursor : 'default' ,
28
+ border : 'none' ,
29
+ backgroundColor,
30
+ ':not(:disabled):hover' : {
31
+ backgroundColor : props . onClick ? backgroundColorHover : backgroundColor ,
32
+ } ,
33
+ } ;
34
+ } ) ;
30
35
31
36
interface ICellButtonProps extends React . ButtonHTMLAttributes < HTMLButtonElement > {
32
37
selected ?: boolean ;
0 commit comments