Browse Source

Merge pull request #164 from meriadec/master

Modal updates
master
Loëck Vézien 7 years ago
committed by GitHub
parent
commit
f2ac8e8379
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/components/base/Modal/index.js

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

@ -30,7 +30,7 @@ type Props = {
} }
const springConfig = { const springConfig = {
stiffness: 350, stiffness: 380,
} }
const mapStateToProps = (state, { name, isOpened }: { name: string, isOpened?: boolean }) => ({ const mapStateToProps = (state, { name, isOpened }: { name: string, isOpened?: boolean }) => ({
@ -77,7 +77,7 @@ const Wrapper = styled(Tabbable).attrs({
mb: 100, mb: 100,
style: p => ({ style: p => ({
opacity: p.op, opacity: p.op,
transform: `translate3d(0, ${p.offset}px, 0)`, transform: `scale3d(${p.scale}, ${p.scale}, ${p.scale})`,
}), }),
})` })`
outline: none; outline: none;
@ -174,22 +174,21 @@ export class Modal extends Component<Props> {
onHide={onHide} onHide={onHide}
motionStyle={(spring, isVisible) => ({ motionStyle={(spring, isVisible) => ({
opacity: spring(isVisible ? 1 : 0, springConfig), opacity: spring(isVisible ? 1 : 0, springConfig),
y: spring(isVisible ? 0 : 20, springConfig), scale: spring(isVisible ? 1 : 0.95, springConfig),
})} })}
> >
{(m, isVisible, isAnimated) => ( {(m, isVisible, isAnimated) => (
<Container isVisible={isVisible}> <Container isVisible={isVisible} onClick={preventBackdropClick ? undefined : onClose}>
<Backdrop op={m.opacity} /> <Backdrop op={m.opacity} />
<GrowScroll <GrowScroll
alignItems="center" alignItems="center"
full full
justifyContent="flex-start" justifyContent="flex-start"
onClick={preventBackdropClick ? undefined : onClose}
style={{ height: '100%' }} style={{ height: '100%' }}
> >
<Wrapper <Wrapper
op={m.opacity} op={m.opacity}
offset={m.y} scale={m.scale}
innerRef={n => (this._wrapper = n)} innerRef={n => (this._wrapper = n)}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
> >

Loading…
Cancel
Save