1
1
import styled , { css } from 'styled-components' ;
2
2
3
3
type OrientationProps = {
4
- isVertical : boolean ;
4
+ $ isVertical : boolean ;
5
5
} ;
6
6
export const topBottomCss = css `
7
7
top : 0 ;
@@ -23,10 +23,10 @@ interface ButtonContainerProps extends OrientationProps {
23
23
}
24
24
export const ButtonContainer = styled . div < ButtonContainerProps > `
25
25
position: absolute;
26
- ${ props => ( props . isVertical ? topBottomCss : leftRightCss ) }
27
- ${ props => ( props . isVertical ? 'width: 5rem' : 'height: 5rem' ) } ;
26
+ ${ props => ( props . $ isVertical ? topBottomCss : leftRightCss ) }
27
+ ${ props => ( props . $ isVertical ? 'width: 5rem' : 'height: 5rem' ) } ;
28
28
transform: ${ props =>
29
- props . isVertical
29
+ props . $ isVertical
30
30
? `translateX(${ props . isLtr ? '-' : '' } 50%) ${
31
31
props . grabberSize ? `translateX(calc(${ props . grabberSize } / 2))` : ''
32
32
} `
@@ -41,18 +41,21 @@ export const ButtonContainer = styled.div<ButtonContainerProps>`
41
41
justify-content: center;
42
42
` ;
43
43
44
- export const ResizeGrabber = styled . div < OrientationProps > `
44
+ interface GrabberProps extends OrientationProps {
45
+ $isCollapsed : boolean ;
46
+ }
47
+ export const ResizeGrabber = styled . div < GrabberProps > `
45
48
position: absolute;
46
49
z-index: 3;
47
- transform: ${ props => ( props . isVertical ? 'translateX(-50%)' : 'translateY(-50%)' ) } ;
48
- cursor: ${ props => ( props . isVertical ? 'col-resize' : 'row-resize' ) } ;
49
- ${ props => ( props . isVertical ? topBottomCss : leftRightCss ) }
50
+ transform: ${ props => ( props . $ isVertical ? 'translateX(-50%)' : 'translateY(-50%)' ) } ;
51
+ cursor: ${ props => ! props . $isCollapsed && ( props . $ isVertical ? 'col-resize' : 'row-resize' ) } ;
52
+ ${ props => ( props . $ isVertical ? topBottomCss : leftRightCss ) }
50
53
` ;
51
54
52
- export const ResizePresentation = styled . div < { isVertical : boolean } > `
55
+ export const ResizePresentation = styled . div < OrientationProps > `
53
56
z-index: 2;
54
57
position: absolute;
55
- ${ props => ( props . isVertical ? topBottomCss : leftRightCss ) }
58
+ ${ props => ( props . $ isVertical ? topBottomCss : leftRightCss ) }
56
59
` ;
57
60
58
61
export const getSizeWithUnit = ( size : string | number ) : string =>
0 commit comments