import React, { createElement } from 'react'; import { DIALOGS, IDialogs } from '~/constants/dialogs'; import classnames from 'classnames'; import { AppInfoDialog } from '~/components/dialogs/AppInfoDialog'; import { Icon } from '~/components/panels/Icon'; import { MapListDialog } from '~/components/dialogs/MapListDialog'; import * as EDITOR_ACTIONS from '~/redux/editor/actions'; interface Props { dialog: keyof IDialogs; dialog_active: Boolean; editorSetDialogActive: typeof EDITOR_ACTIONS.editorSetDialogActive; } const LEFT_DIALOGS = { [DIALOGS.MAP_LIST]: MapListDialog, [DIALOGS.APP_INFO]: AppInfoDialog, }; const LeftDialog = ({ dialog, dialog_active, editorSetDialogActive }: Props) => ( {Object.keys(LEFT_DIALOGS).map(item => (
{dialog && LEFT_DIALOGS[item] && createElement(LEFT_DIALOGS[item], {})}
editorSetDialogActive(false)}>
editorSetDialogActive(false)}>
))}
); export { LeftDialog };