import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { Collapse, Button } from 'reactstrap'; import NavigationContainer from '../../services/NavigationContainer'; import EditorContainer from '../../services/EditorContainer'; import AppContainer from '../../services/AppContainer'; import SlackNotification from '../SlackNotification'; import SlackLogo from '../SlackLogo'; import { withUnstatedContainers } from '../UnstatedUtils'; import SavePageControls from '../SavePageControls'; import OptionsSelector from './OptionsSelector'; const EditorNavbarBottom = (props) => { const [isExpanded, setExpanded] = useState(false); const [isSlackExpanded, setSlackExpanded] = useState(false); const hasSlackConfig = props.appContainer.getConfig().hasSlackConfig; const { navigationContainer, } = props; const { editorMode, isDeviceSmallerThanMd } = navigationContainer.state; const additionalClasses = ['grw-editor-navbar-bottom']; const renderDrawerButton = () => ( ); const slackEnabledFlagChangedHandler = (isSlackEnabled) => { props.editorContainer.setState({ isSlackEnabled }); }; const slackChannelsChangedHandler = (slackChannels) => { props.editorContainer.setState({ slackChannels }); }; // eslint-disable-next-line react/prop-types const renderExpandButton = () => (
); const isOptionsSelectorEnabled = editorMode !== 'hackmd'; const isCollapsedOptionsSelectorEnabled = isOptionsSelectorEnabled && isDeviceSmallerThanMd; return (
{/* Collapsed SlackNotification */} {hasSlackConfig && ( ) }
{ isDeviceSmallerThanMd && renderDrawerButton() } { isOptionsSelectorEnabled && !isDeviceSmallerThanMd && }
{/* Responsive Design for the SlackNotification */} {/* Button or the normal Slack banner */} {hasSlackConfig && (isDeviceSmallerThanMd ? ( ) : (
))} { isCollapsedOptionsSelectorEnabled && renderExpandButton() }
{/* Collapsed OptionsSelector */} { isCollapsedOptionsSelectorEnabled && (
{/* set padding for border-top */}
) }
); }; EditorNavbarBottom.propTypes = { navigationContainer: PropTypes.instanceOf(NavigationContainer).isRequired, appContainer: PropTypes.instanceOf(AppContainer).isRequired, editorContainer: PropTypes.instanceOf(EditorContainer).isRequired, }; export default withUnstatedContainers(EditorNavbarBottom, [NavigationContainer, EditorContainer, AppContainer]);