|
|
@@ -1,6 +1,7 @@
|
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
+import { Collapse } from 'reactstrap';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
|
/**
|
|
|
@@ -19,6 +20,7 @@ class SlackNotification extends React.Component {
|
|
|
|
|
|
this.updateCheckboxHandler = this.updateCheckboxHandler.bind(this);
|
|
|
this.updateSlackChannelsHandler = this.updateSlackChannelsHandler.bind(this);
|
|
|
+ this.state = { isExpanded: false };
|
|
|
}
|
|
|
|
|
|
updateCheckboxHandler(event) {
|
|
|
@@ -35,7 +37,7 @@ class SlackNotification extends React.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- render() {
|
|
|
+ getSlackNormal() {
|
|
|
const { t } = this.props;
|
|
|
|
|
|
return (
|
|
|
@@ -69,6 +71,45 @@ class SlackNotification extends React.Component {
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ setExpanded= (value) => {
|
|
|
+ this.setState({ isExpanded: value });
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+Note to myself:
|
|
|
+The collapse stuff worked, but it should be put in the EditorNavbarBottom level of rendering. The state should be
|
|
|
+lifted and button here would only be a trigger for the function at the parrent level. The passed down props would only
|
|
|
+affect the rendering of the banner itself.
|
|
|
+*/
|
|
|
+ getSlackButton() {
|
|
|
+ return (
|
|
|
+ <div className="grw-slack-notification">
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ onClick={() => this.setExpanded(!this.state.isExpanded)}
|
|
|
+ >
|
|
|
+ <i className="icon-arrow-up"></i>
|
|
|
+ </button>
|
|
|
+ <Collapse isOpen={this.state.isExpanded}>
|
|
|
+ <div className="px-2"> {/* set padding for border-top */}
|
|
|
+ <div className="navbar navbar-expand border-top px-0">
|
|
|
+ <form className="form-inline ml-auto">
|
|
|
+ {this.getSlackNormal()}
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Collapse>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ this.props.smallScreen ? this.getSlackButton() : this.getSlackNormal()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -76,6 +117,7 @@ class SlackNotification extends React.Component {
|
|
|
SlackNotification.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
|
|
|
+ smallScreen: PropTypes.bool.isRequired,
|
|
|
isSlackEnabled: PropTypes.bool.isRequired,
|
|
|
slackChannels: PropTypes.string.isRequired,
|
|
|
onEnabledFlagChange: PropTypes.func,
|