Capitalize "overlayNode" prop
parent
f077d28ec4
commit
97edb7d316
|
@ -1,6 +1,6 @@
|
|||
import {ReactElement} from 'react'
|
||||
|
||||
type OverlayNode = ReactElement<any>
|
||||
type OverlayNodeType = ReactElement<any>
|
||||
|
||||
interface Options {
|
||||
dismissOnClickOutside?: boolean
|
||||
|
@ -8,9 +8,12 @@ interface Options {
|
|||
transitionTime?: number
|
||||
}
|
||||
|
||||
export const showOverlay = (overlayNode: OverlayNode, options: Options) => ({
|
||||
export const showOverlay = (
|
||||
OverlayNode: OverlayNodeType,
|
||||
options: Options
|
||||
) => ({
|
||||
type: 'SHOW_OVERLAY',
|
||||
payload: {overlayNode, options},
|
||||
payload: {OverlayNode, options},
|
||||
})
|
||||
|
||||
export const dismissOverlay = () => ({
|
||||
|
|
|
@ -6,7 +6,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
|
|||
import {dismissOverlay} from 'src/shared/actions/overlayTechnology'
|
||||
|
||||
interface Props {
|
||||
overlayNode?: ReactElement<any>
|
||||
OverlayNode?: ReactElement<any>
|
||||
dismissOnClickOutside?: boolean
|
||||
dismissOnEscape?: boolean
|
||||
transitionTime?: number
|
||||
|
@ -36,19 +36,19 @@ class Overlay extends PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
public componentDidUpdate(prevProps) {
|
||||
if (prevProps.overlayNode === null && this.props.overlayNode) {
|
||||
if (prevProps.OverlayNode === null && this.props.OverlayNode) {
|
||||
return this.setState({visible: true})
|
||||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
const {overlayNode} = this.props
|
||||
const {OverlayNode} = this.props
|
||||
|
||||
return (
|
||||
<div className={this.overlayClass}>
|
||||
<div className="overlay--dialog">
|
||||
{overlayNode &&
|
||||
React.cloneElement(overlayNode, {
|
||||
{OverlayNode &&
|
||||
React.cloneElement(OverlayNode, {
|
||||
onDismissOverlay: this.handleAnimateDismiss,
|
||||
})}
|
||||
</div>
|
||||
|
@ -85,11 +85,11 @@ class Overlay extends PureComponent<Props, State> {
|
|||
|
||||
const mapStateToProps = ({
|
||||
overlayTechnology: {
|
||||
overlayNode,
|
||||
OverlayNode,
|
||||
options: {dismissOnClickOutside, dismissOnEscape, transitionTime},
|
||||
},
|
||||
}) => ({
|
||||
overlayNode,
|
||||
OverlayNode,
|
||||
dismissOnClickOutside,
|
||||
dismissOnEscape,
|
||||
transitionTime,
|
||||
|
|
|
@ -4,22 +4,22 @@ const initialState = {
|
|||
dismissOnEscape: false,
|
||||
transitionTime: 300,
|
||||
},
|
||||
overlayNode: null,
|
||||
OverlayNode: null,
|
||||
}
|
||||
|
||||
export default function overlayTechnology(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case 'SHOW_OVERLAY': {
|
||||
const {overlayNode, options} = action.payload
|
||||
const {OverlayNode, options} = action.payload
|
||||
|
||||
return {...state, overlayNode, options}
|
||||
return {...state, OverlayNode, options}
|
||||
}
|
||||
|
||||
case 'DISMISS_OVERLAY': {
|
||||
const {options} = initialState
|
||||
return {
|
||||
...state,
|
||||
overlayNode: null,
|
||||
OverlayNode: null,
|
||||
options,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue