Browse Source

Add GrowScroll in Modal

master
Loëck Vézien 7 years ago
parent
commit
7e72f008d6
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 17
      src/components/base/GrowScroll/index.js
  2. 11
      src/components/base/Modal/index.js
  3. 5
      src/main/app.js

17
src/components/base/GrowScroll/index.js

@ -7,13 +7,15 @@ import noop from 'lodash/noop'
import Box from 'components/base/Box'
type Props = {
maxHeight?: number,
children: any,
full: boolean,
maxHeight?: number,
onUpdate: Function,
}
class GrowScroll extends PureComponent<Props> {
static defaultProps = {
full: false,
onUpdate: noop,
}
@ -34,10 +36,19 @@ class GrowScroll extends PureComponent<Props> {
_scrollbar = undefined
render() {
const { onUpdate, children, maxHeight, ...props } = this.props
const { onUpdate, children, maxHeight, full, ...props } = this.props
return (
<Box grow relative>
<Box
{...(full
? {
sticky: true,
}
: {
grow: true,
relative: true,
})}
>
<Scrollbar
damping={1}
style={{

11
src/components/base/Modal/index.js

@ -14,6 +14,7 @@ import { rgba } from 'styles/helpers'
import { closeModal, isModalOpened, getModalData } from 'reducers/modals'
import Box from 'components/base/Box'
import GrowScroll from 'components/base/GrowScroll'
import Icon from 'components/base/Icon'
type Props = {
@ -52,8 +53,8 @@ const Container = styled(Box).attrs({
pointerEvents: p.isVisible ? 'auto' : 'none',
}),
})`
overflow: scroll;
position: fixed;
top: ${process.platform === 'darwin' ? 40 : 0}px;
z-index: 20;
`
@ -126,9 +127,11 @@ export class Modal extends PureComponent<Props> {
{(m, isVisible) => (
<Container isVisible={isVisible}>
<Backdrop op={m.opacity} onClick={preventBackdropClick ? undefined : onClose} />
<Wrapper preventSideMargin={preventSideMargin} op={m.opacity} offset={m.y}>
{render({ data, onClose })}
</Wrapper>
<GrowScroll full align="center">
<Wrapper preventSideMargin={preventSideMargin} op={m.opacity} offset={m.y}>
{render({ data, onClose })}
</Wrapper>
</GrowScroll>
</Container>
)}
</Mortal>

5
src/main/app.js

@ -80,11 +80,6 @@ const installExtensions = async () => {
app.setAsDefaultProtocolClient('ledgerhq')
app.on('open-url', (e, url) => {
e.preventDefault()
console.log('open url', e, url)
})
app.on('ready', async () => {
if (__DEV__) {
await installExtensions()

Loading…
Cancel
Save