feat(info): automatically show the info dialog (#2018)

* ref(info): be able to open dialog through store

* feat(info): automatically show the info dialog

Conditions:
- Lonely call
- Has not opened the info dialog yet

* squash: change to show on start, hide later

* squash: update naming and comment
This commit is contained in:
virtuacoplenny
2017-09-29 13:27:23 -07:00
committed by yanas
parent 802d347574
commit cfe4564ab3
10 changed files with 258 additions and 34 deletions

View File

@@ -7,23 +7,12 @@ import React, { Component } from 'react';
import { translate } from '../../base/i18n';
import { TOOLTIP_TO_POPUP_POSITION } from '../constants';
import { isButtonEnabled } from '../functions';
import StatelessToolbarButton from './StatelessToolbarButton';
declare var APP: Object;
/**
* Mapping of tooltip positions to equivalent {@code AKInlineDialog} positions.
*
* @private
*/
const TOOLTIP_TO_POPUP_POSITION = {
bottom: 'bottom center',
left: 'left middle',
top: 'top center',
right: 'right middle'
};
/**
* Represents a button in Toolbar on React.
*

View File

@@ -3,21 +3,9 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { TOOLTIP_TO_POPUP_POSITION } from '../constants';
import ToolbarButton from './ToolbarButton';
/**
* Maps AtlasKit {@code Tooltip} positions to equivalent {@code InlineDialog}
* positions. The {@code InlineDialog} will appear from the the same side of
* the button as the tooltip.
*
*/
const TOOLTIP_TO_DIALOG_POSITION = {
bottom: 'bottom center',
left: 'left middle',
right: 'right middle',
top: 'top center'
};
/**
* React {@code Component} for displaying a button which will open an inline
* dialog.
@@ -113,7 +101,7 @@ class ToolbarButtonWithDialog extends Component {
content = { <Content onClose = { this._onDialogClose } /> }
isOpen = { _visible && this.state.showDialog }
onClose = { this._onDialogClose }
position = { TOOLTIP_TO_DIALOG_POSITION[tooltipPosition] }>
position = { TOOLTIP_TO_POPUP_POSITION[tooltipPosition] }>
<ToolbarButton
button = { buttonConfiguration }
onClick = { this._onDialogToggle }