8000 feat(desktop): drop-down stub (#346) · qiwi/pijma@a414ee8 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit a414ee8

Browse files
authored
feat(desktop): drop-down stub (#346)
1 parent ffb3119 commit a414ee8

File tree

1 file changed

+42
-24
lines changed

1 file changed

+42
-24
lines changed
Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import React, {FC} from 'react'
22

3-
import {Overlay, OverlayProps, SimpleTransition, SimpleTransitionProps, css, Pos, Value} from '@qiwi/pijma-core'
3+
import {
4+
Overlay,
5+
OverlayProps,
6+
SimpleTransition,
7+
SimpleTransitionProps,
8+
css,
9+
Pos,
10+
Value,
11+
Box,
12+
} from '@qiwi/pijma-core'
413

514
export interface DropDownProps {
615
show: boolean
@@ -9,6 +18,7 @@ export interface DropDownProps {
918
minWidth?: Value
1019
maxWidth?: Value
1120
rootClose?: boolean
21+
stub?: boolean
1222
target: OverlayProps['target']
1323
container: OverlayProps['container']
1424
children: React.ReactElement
@@ -39,36 +49,44 @@ export const DropDown: FC<DropDownProps> = ({
3949
minWidth,
4050
maxWidth,
4151
rootClose = true,
52+
stub = false,
4253
target,
4354
container,
4455
onHide,
4556
children,
4657
}) => (
47-
<Overlay
48-
show={show}
49-
placement="bottom"
50-
target={target}
51-
container={container}
52-
rootClose={rootClose}
53-
onHide={onHide}
54-
transition={transition}
55-
children={(renderProps) => (
56-
<Pos
57-
type="absolute"
58-
width={width}
59-
minWidth={minWidth}
60-
maxWidth={maxWidth}
61-
zIndex={999}
62-
ref={renderProps.props.ref}
63-
mt={offset}
64-
css={renderProps.props.style}
65-
>
66-
{children}
67-
</Pos>
68-
)}
69-
/>
58+
stub ? (
59+
<Box display="none">
60+
{children}
61+
</Box>
62+
) : (
63+
<Overlay
64+
show={show}
65+
placement="bottom"
66+
target={target}
67+
container={container}
68+
rootClose={rootClose}
69+
onHide={onHide}
70+
transition={transition}
71+
children={(renderProps) => (
72+
<Pos
73+
type="absolute"
74+
width={width}
75+
minWidth={minWidth}
76+
maxWidth={maxWidth}
77+
zIndex={999}
78+
ref={renderProps.props.ref}
79+
mt={offset}
80+
css={renderProps.props.style}
81+
>
82+
{children}
83+
</Pos>
84+
)}
85+
/>
86+
)
7087
)
7188

7289
DropDown.defaultProps = {
7390
rootClose: true,
91+
stub: false,
7492
}

0 commit comments

Comments
 (0)
0