2017-09-18 20:52:10 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2019-01-22 10:35:28 +00:00
|
|
|
import { ColorSchemeRegistry } from '../color-scheme';
|
2017-09-18 20:52:10 +00:00
|
|
|
import { toState } from '../redux';
|
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* Checks if a {@code Dialog} with a specific {@code component} is currently
|
2017-09-18 20:52:10 +00:00
|
|
|
* open.
|
|
|
|
*
|
|
|
|
* @param {Function|Object} stateful - The redux store, the redux
|
2017-10-01 06:35:19 +00:00
|
|
|
* {@code getState} function, or the redux state itself.
|
|
|
|
* @param {React.Component} component - The {@code component} of a
|
|
|
|
* {@code Dialog} to be checked.
|
2017-09-18 20:52:10 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
export function isDialogOpen(stateful: Function | Object, component: Object) {
|
|
|
|
return toState(stateful)['features/base/dialog'].component === component;
|
|
|
|
}
|
2019-01-22 10:35:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of any Dialog based component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @returns {{
|
|
|
|
* _dialogStyles: StyleType
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function _abstractMapStateToProps(state: Object): Object {
|
|
|
|
return {
|
|
|
|
_dialogStyles: ColorSchemeRegistry.get(state, 'Dialog')
|
|
|
|
};
|
|
|
|
}
|