|
@@ -1,15 +1,15 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
+import { withUnstatedContainers } from '../UnstatedUtils';
|
|
|
|
|
|
|
|
-const ThreeStrandedButton = (props) => {
|
|
|
|
|
|
|
+import NavigationContainer from '../../services/NavigationContainer';
|
|
|
|
|
|
|
|
- const { t } = props;
|
|
|
|
|
|
|
+const ThreeStrandedButton = (props) => {
|
|
|
|
|
+ const { t, navigationContainer } = props;
|
|
|
|
|
|
|
|
function threeStrandedButtonClickedHandler(viewType) {
|
|
function threeStrandedButtonClickedHandler(viewType) {
|
|
|
- if (props.onThreeStrandedButtonClicked != null) {
|
|
|
|
|
- props.onThreeStrandedButtonClicked(viewType);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ navigationContainer.setEditorMode(viewType);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -31,9 +31,16 @@ const ThreeStrandedButton = (props) => {
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Wrapper component for using unstated
|
|
|
|
|
+ */
|
|
|
|
|
+const ThreeStrandedButtonWrapper = withUnstatedContainers(ThreeStrandedButton, [NavigationContainer]);
|
|
|
|
|
+
|
|
|
ThreeStrandedButton.propTypes = {
|
|
ThreeStrandedButton.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
|
|
+
|
|
|
|
|
+ navigationContainer: PropTypes.object.isRequired,
|
|
|
onThreeStrandedButtonClicked: PropTypes.func,
|
|
onThreeStrandedButtonClicked: PropTypes.func,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-export default withTranslation()(ThreeStrandedButton);
|
|
|
|
|
|
|
+export default withTranslation()(ThreeStrandedButtonWrapper);
|