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

feat(desktop): drop-down stub #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 42 additions & 24 deletions packages/desktop/src/drop-down/DropDown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React, {FC} from 'react'

import {Overlay, OverlayProps, SimpleTransition, SimpleTransitionProps, css, Pos, Value} from '@qiwi/pijma-core'
import {
Overlay,
OverlayProps,
SimpleTransition,
SimpleTransitionProps,
css,
Pos,
Value,
Box,
} from '@qiwi/pijma-core'

export interface DropDownProps {
show: boolean
Expand All @@ -9,6 +18,7 @@ export interface DropDownProps {
minWidth?: Value
maxWidth?: Value
rootClose?: boolean
stub?: boolean
target: OverlayProps['target']
container: OverlayProps['container']
children: React.ReactElement
Expand Down Expand Up @@ -39,36 +49,44 @@ export const DropDown: FC<DropDownProps> = ({
minWidth,
maxWidth,
rootClose = true,
stub = false,
target,
container,
onHide,
children,
}) => (
<Overlay
show={show}
placement="bottom"
target={target}
container={container}
rootClose={rootClose}
>
transition={transition}
children={(renderProps) => (
<Pos
type="absolute"
width={width}
minWidth={minWidth}
maxWidth={maxWidth}
zIndex={999}
ref={renderProps.props.ref}
mt={offset}
css={renderProps.props.style}
>
{children}
</Pos>
)}
/>
stub ? (
<Box display="none">
{children}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем children внутри display=none?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если в дропдауне будет асинхронный модуль, надо чтобы он на сервере загрузился, и при открытии дропдауна сразу показался серверный стаб

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ок

</Box>
) : (
<Overlay
show={show}
placement="bottom"
target={target}
container={container}
rootClose={rootClose}
>
transition={transition}
children={(renderProps) => (
<Pos
type="absolute"
width={width}
minWidth={minWidth}
maxWidth={maxWidth}
zIndex={999}
ref={renderProps.props.ref}
mt={offset}
css={renderProps.props.style}
>
{children}
</Pos>
)}
/>
)
)

DropDown.defaultProps = {
rootClose: true,
stub: false,
}
0