From a0b4457676d7ba7fc24d0f14fce5e4c699e875cd Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Sep 2016 18:22:17 -0300 Subject: [PATCH] Ivan - Frontend - Create static method for open modal, improve animation, add accessibility [skip ci] --- client/src/app-components/are-you-sure.js | 14 +++++--- client/src/app/App.js | 16 +++++++-- client/src/app/app.scss | 12 +++++++ client/src/app/demo/components-demo-page.js | 10 ++---- client/src/app/modal-container.js | 11 ++++++- client/src/core-components/button.js | 5 +++ client/src/core-components/button.scss | 36 ++++++++++++--------- client/src/core-components/modal.js | 23 ++++++------- client/src/core-components/modal.scss | 2 +- client/src/scss/_base.scss | 1 - 10 files changed, 83 insertions(+), 47 deletions(-) create mode 100644 client/src/app/app.scss diff --git a/client/src/app-components/are-you-sure.js b/client/src/app-components/are-you-sure.js index df76ee79..a1502c09 100644 --- a/client/src/app-components/are-you-sure.js +++ b/client/src/app-components/are-you-sure.js @@ -13,23 +13,27 @@ class AreYouSure extends React.Component { closeModal: React.PropTypes.func }; + componentDidMount() { + this.refs.yesButton && this.refs.yesButton.focus(); + } + render() { return ( -
-
+
+
{i18n('ARE_YOU_SURE')}
-
+
{this.props.description}
-
-
diff --git a/client/src/app/App.js b/client/src/app/App.js index e35a0be7..00f2efdf 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -1,5 +1,6 @@ import React from 'react'; import _ from 'lodash'; +import classNames from 'classnames'; import { connect } from 'react-redux' import { browserHistory } from 'react-router'; @@ -21,13 +22,24 @@ class App extends React.Component { render() { return ( -
- {React.cloneElement(this.props.children, {})} +
+
+ {React.cloneElement(this.props.children, {})} +
); } + getClass() { + let classes = { + 'application': true, + 'application_modal-opened': (this.props.modal.opened) + }; + + return classNames(classes); + } + redirectIfPathIsNotValid(props) { const validations = { languageChanged: props.config.language !== this.props.config.language, diff --git a/client/src/app/app.scss b/client/src/app/app.scss new file mode 100644 index 00000000..feccbaf6 --- /dev/null +++ b/client/src/app/app.scss @@ -0,0 +1,12 @@ +@import "../scss/vars"; + +.application { + padding: $half-space; + + &_modal-opened { + .application__content { + position: fixed; + overflow: hidden; + } + } +} \ No newline at end of file diff --git a/client/src/app/demo/components-demo-page.js b/client/src/app/demo/components-demo-page.js index 874edabb..04473348 100644 --- a/client/src/app/demo/components-demo-page.js +++ b/client/src/app/demo/components-demo-page.js @@ -3,9 +3,7 @@ const React = require('react'); const DocumentTitle = require('react-document-title'); -const ModalActions = require('actions/modal-actions'); -const store = require('app/store'); - +const ModalContainer = require('app/modal-container'); const AreYouSure = require('app-components/are-you-sure'); const Button = require('core-components/button'); @@ -96,10 +94,8 @@ let DemoPage = React.createClass({ title: 'ModalTrigger', render: (