diff --git a/src/components/browser-modal/browser-modal.css b/src/components/browser-modal/browser-modal.css index aa8840c4cc8..a7f86ac4efe 100644 --- a/src/components/browser-modal/browser-modal.css +++ b/src/components/browser-modal/browser-modal.css @@ -34,6 +34,10 @@ background-size: cover; } +[dir="rtl"] .illustration { + transform: scaleX(-1); +} + .body { background: $ui-white; padding: 1.5rem 2.25rem; diff --git a/src/components/browser-modal/browser-modal.jsx b/src/components/browser-modal/browser-modal.jsx index 457105727df..0a271ea7a78 100644 --- a/src/components/browser-modal/browser-modal.jsx +++ b/src/components/browser-modal/browser-modal.jsx @@ -22,62 +22,65 @@ const BrowserModal = ({intl, ...props}) => ( overlayClassName={styles.modalOverlay} onRequestClose={props.onBack} > - +
+ - -

- -

-

- { /* eslint-disable max-len */ } - - { /* eslint-enable max-len */ } -

- - - + { /* eslint-enable max-len */ } +

+ + + + +
+ + + + ) + }} + /> +
-
- - - - ) - }} - /> -
-
+
); BrowserModal.propTypes = { intl: intlShape.isRequired, + isRtl: PropTypes.bool, onBack: PropTypes.func.isRequired }; diff --git a/src/components/gui/gui.jsx b/src/components/gui/gui.jsx index c7859c5aa54..96fea86537f 100644 --- a/src/components/gui/gui.jsx +++ b/src/components/gui/gui.jsx @@ -125,7 +125,7 @@ const GUIComponent = props => { ) : null} {isRendererSupported ? null : ( - + )} {tipsLibraryVisible ? ( diff --git a/src/components/import-modal/import-modal.css b/src/components/import-modal/import-modal.css index b265efae02f..7da215c015b 100644 --- a/src/components/import-modal/import-modal.css +++ b/src/components/import-modal/import-modal.css @@ -82,6 +82,10 @@ $sides: 20rem; justify-content: flex-start; } +[dir="rtl"] .header-item-close img { + transform: scaleX(-1); +} + .body { background: $ui-white; padding: 1.5rem 2.25rem; diff --git a/src/components/import-modal/import-modal.jsx b/src/components/import-modal/import-modal.jsx index 992b801e71d..1028d5ddc20 100644 --- a/src/components/import-modal/import-modal.jsx +++ b/src/components/import-modal/import-modal.jsx @@ -42,110 +42,112 @@ const ImportModal = ({intl, ...props}) => ( overlayClassName={styles.modalOverlay} onRequestClose={props.onCancel} > - -
-
- -
-
-

- {intl.formatMessage({...messages.title})} -

-
-
- {null} +
+ +
+
+ +
+
+

+ {intl.formatMessage({...messages.title})} +

+
+
+ {null} +
-
- + - -

- {intl.formatMessage({...messages.formDescription})} -

- - - - - {props.hasValidationError ? - -

+ + + {props.hasValidationError ? + +

+ +

+
: null + } + + + + + + + ) + }} /> - - - - - - - ) - }} - /> +
- +
); diff --git a/src/components/preview-modal/preview-modal.css b/src/components/preview-modal/preview-modal.css index d6cf6dc4568..6e17cb6ea08 100644 --- a/src/components/preview-modal/preview-modal.css +++ b/src/components/preview-modal/preview-modal.css @@ -74,17 +74,28 @@ color: white; } -.button-row button + button { +[dir="ltr"] .button-row button + button { margin-left: 0.5rem; } +[dir="rtl"] .button-row button + button { + margin-right: 0.5rem; +} + .cat-icon { - margin-left: .125rem; width: 1.5rem; height: 1.5rem; vertical-align: middle; } +[dir="ltr"] .cat-icon { + margin-left: .125rem; +} + +[dir="rtl"] .cat-icon { + margin-right: .125rem; +} + .faq-link-text { margin: 2rem 0 .5rem 0; font-size: .875rem; diff --git a/src/components/preview-modal/preview-modal.jsx b/src/components/preview-modal/preview-modal.jsx index 08c6be77b53..2c946bb422b 100644 --- a/src/components/preview-modal/preview-modal.jsx +++ b/src/components/preview-modal/preview-modal.jsx @@ -28,106 +28,111 @@ const PreviewModal = ({intl, ...props}) => ( overlayClassName={styles.modalOverlay} onRequestClose={props.onTryIt} > - +
+ - -

- -

-

- -

- - - - + + + + + previewFaqLink: ( + + + ) }} /> - - - - - - - - ) - }} - /> +
-
+
); PreviewModal.propTypes = { intl: intlShape.isRequired, + isRtl: PropTypes.bool, onCancel: PropTypes.func.isRequired, onTryIt: PropTypes.func.isRequired, onViewProject: PropTypes.func.isRequired diff --git a/src/components/webgl-modal/webgl-modal.css b/src/components/webgl-modal/webgl-modal.css index f1b6ff6efee..10eed71f1d4 100644 --- a/src/components/webgl-modal/webgl-modal.css +++ b/src/components/webgl-modal/webgl-modal.css @@ -34,6 +34,10 @@ background-size: cover; } +[dir="rtl"] .illustration { + transform: scaleX(-1); +} + .body { background: $ui-white; padding: 1.5rem 2.25rem; diff --git a/src/components/webgl-modal/webgl-modal.jsx b/src/components/webgl-modal/webgl-modal.jsx index f0c3c6c2752..faf5ac55171 100644 --- a/src/components/webgl-modal/webgl-modal.jsx +++ b/src/components/webgl-modal/webgl-modal.jsx @@ -22,76 +22,79 @@ const WebGlModal = ({intl, ...props}) => ( overlayClassName={styles.modalOverlay} onRequestClose={props.onBack} > - +
+ - -

- -

-

- { /* eslint-disable max-len */ } - - - - ) - }} - /> - { /* eslint-enable max-len */ } -

- - - + { /* eslint-enable max-len */ } +

+ + + + +
+ + + + ) + }} + /> +
-
- - - - ) - }} - /> -
-
+
); WebGlModal.propTypes = { intl: intlShape.isRequired, + isRtl: PropTypes.bool, onBack: PropTypes.func.isRequired }; diff --git a/src/containers/error-boundary.jsx b/src/containers/error-boundary.jsx index 52e522d5aae..fbb15f3b998 100644 --- a/src/containers/error-boundary.jsx +++ b/src/containers/error-boundary.jsx @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import {connect} from 'react-redux'; import bowser from 'bowser'; import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx'; import CrashMessageComponent from '../components/crash-message/crash-message.jsx'; @@ -57,7 +58,10 @@ class ErrorBoundary extends React.Component { if (supportedBrowser()) { return ; } - return ; + return (); } return this.props.children; } @@ -65,7 +69,15 @@ class ErrorBoundary extends React.Component { ErrorBoundary.propTypes = { action: PropTypes.string.isRequired, // Used for defining tracking action - children: PropTypes.node + children: PropTypes.node, + isRtl: PropTypes.bool }; -export default ErrorBoundary; +const mapStateToProps = state => ({ + isRtl: state.locales.isRtl +}); + +// no-op function to prevent dispatch prop being passed to component +const mapDispatchToProps = () => {}; + +export default connect(mapStateToProps, mapDispatchToProps)(ErrorBoundary); diff --git a/src/containers/import-modal.jsx b/src/containers/import-modal.jsx index 0731098f156..1c75929cf56 100644 --- a/src/containers/import-modal.jsx +++ b/src/containers/import-modal.jsx @@ -73,6 +73,7 @@ class ImportModal extends React.Component { errorMessage={this.state.errorMessage} hasValidationError={this.state.hasValidationError} inputValue={this.state.inputValue} + isRtl={this.props.isRtl} placeholder="scratch.mit.edu/projects/123456789" onCancel={this.handleCancel} onChange={this.handleChange} @@ -85,12 +86,15 @@ class ImportModal extends React.Component { } ImportModal.propTypes = { + isRtl: PropTypes.bool, onBack: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, onViewProject: PropTypes.func }; -const mapStateToProps = () => ({}); +const mapStateToProps = state => ({ + isRtl: state.locales.isRtl +}); const mapDispatchToProps = dispatch => ({ onBack: () => { diff --git a/src/containers/preview-modal.jsx b/src/containers/preview-modal.jsx index a53f398ee70..7145cfa6acb 100644 --- a/src/containers/preview-modal.jsx +++ b/src/containers/preview-modal.jsx @@ -39,12 +39,12 @@ class PreviewModal extends React.Component { // otherwise, show the intro modal return (); - } handleTryIt () { this.setState({previewing: true}); @@ -62,6 +62,7 @@ class PreviewModal extends React.Component { return (supportedBrowser() ? this.introIfShown() : ); @@ -70,11 +71,14 @@ class PreviewModal extends React.Component { PreviewModal.propTypes = { hideIntro: PropTypes.bool, + isRtl: PropTypes.bool, onTryIt: PropTypes.func, onViewProject: PropTypes.func }; -const mapStateToProps = () => ({}); +const mapStateToProps = state => ({ + isRtl: state.locales.isRtl +}); const mapDispatchToProps = dispatch => ({ onTryIt: () => { diff --git a/src/containers/webgl-modal.jsx b/src/containers/webgl-modal.jsx index 02e43bf01db..d6633f30394 100644 --- a/src/containers/webgl-modal.jsx +++ b/src/containers/webgl-modal.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import WebGlModalComponent from '../components/webgl-modal/webgl-modal.jsx'; @@ -9,10 +10,15 @@ class WebGlModal extends React.Component { render () { return ( ); } } +WebGlModal.propTypes = { + isRtl: PropTypes.bool +}; + export default WebGlModal;