From bfd85dff6b086abae1c16014e318c89cba929b66 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Fri, 17 Feb 2017 09:57:19 -0200 Subject: [#907] Makes login page responsive --- service/test/functional/features/steps/login.py | 6 +- web-ui/src/common/input_field/input_field.js | 14 ++- web-ui/src/login/app.js | 16 ++- web-ui/src/login/app.scss | 30 +++++ web-ui/src/login/login.css | 150 ++++++++---------------- web-ui/src/login/login.html | 4 +- 6 files changed, 101 insertions(+), 119 deletions(-) create mode 100644 web-ui/src/login/app.scss diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index 6ee521e9..fb8f08ef 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -29,13 +29,13 @@ def login_page(context): @when(u'I enter {username} and {password} as credentials') def enter_credentials(context, username, password): - fill_by_css_selector(context, 'input#email', context.username) - fill_by_css_selector(context, 'input#password', password) + fill_by_css_selector(context, 'input[name="username"]', context.username) + fill_by_css_selector(context, 'input[name="password"]', password) @when(u'I click on the login button') def click_login(context): - find_element_by_css_selector(context, 'input[name="login"]').click() + find_element_by_css_selector(context, 'input[type="submit"]').click() @then(u'I should see the fancy interstitial') diff --git a/web-ui/src/common/input_field/input_field.js b/web-ui/src/common/input_field/input_field.js index 1378ba74..d4876d9f 100644 --- a/web-ui/src/common/input_field/input_field.js +++ b/web-ui/src/common/input_field/input_field.js @@ -19,16 +19,24 @@ import React from 'react'; import './input-field.scss'; -const InputField = ({ label, name }) => ( +const InputField = ({ label, name, type = 'text' }) => (
- +
); InputField.propTypes = { label: React.PropTypes.string.isRequired, - name: React.PropTypes.string.isRequired + name: React.PropTypes.string.isRequired, + type: React.PropTypes.string +}; + +InputField.defaultProps = { + type: 'text' }; export default InputField; diff --git a/web-ui/src/login/app.js b/web-ui/src/login/app.js index dda6148c..ee5a7652 100644 --- a/web-ui/src/login/app.js +++ b/web-ui/src/login/app.js @@ -17,18 +17,16 @@ import React from 'react'; import { translate } from 'react-i18next'; +import InputField from 'src/common/input_field/input_field'; +import SubmitButton from 'src/common/submit_button/submit_button'; + +import './app.scss'; export const App = ({ t }) => (
- - - + + + ); diff --git a/web-ui/src/login/app.scss b/web-ui/src/login/app.scss new file mode 100644 index 00000000..76390cb7 --- /dev/null +++ b/web-ui/src/login/app.scss @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see . + */ + +#login_form { + padding: 20px 0; + + .input-field-group { + width: 100%; + } +} + +@media only screen and (min-width : 500px) { + #login_form .input-field-group { + margin-top: 1em; + } +} diff --git a/web-ui/src/login/login.css b/web-ui/src/login/login.css index 51ab2046..bbb37443 100644 --- a/web-ui/src/login/login.css +++ b/web-ui/src/login/login.css @@ -16,130 +16,74 @@ */ body { - font-family: "Open Sans", "Microsoft YaHei", "Hiragino Sans GB", "Hiragino Sans GB W3", "微软雅黑", "Helvetica Neue", Arial, sans-serif; - background-color: #EAEAEA; - height: 100vh; - color: #3E3A37; + font-family: "Open Sans", "Microsoft YaHei", "Hiragino Sans GB", "Hiragino Sans GB W3", "微软雅黑", "Helvetica Neue", Arial, sans-serif; + background-color: #EAEAEA; + height: 100vh; + color: #3E3A37; - background-image: url("/public/images/hive-bg.png"); - background-repeat: repeat; -} - -.content { - height: 100vh; - width: 100%; + background-image: url("/public/images/hive-bg.png"); + background-repeat: repeat; } .error { - color: #D72A25; - margin: 10px 0 0 0; -} - -.message-panel { - width: 100%; - margin: 10px auto; - z-index: 10000; - text-align: center; - } - -.message-panel span{ - background: #F7E8AF; - padding: 5px 60px; - border: 1px solid #f2db81; - color: #987b0f; - box-shadow: 1px 1px 3px #69560b; -} - -.message-panel.message-panel-small span{ - padding: 5px 0px; - display: inline-block; - width: 100%; + color: #D72A25; + margin: 10px 0 0 0; } .login { - display: block; - width: 240px; - margin: auto; - padding: 45px 40px 35px 40px; - background-color: #FFF; - margin-top: 2%; - margin-bottom: 2%; + display: block; + width: 90%; + margin: auto; + max-width: 400px; + padding: 2em 0; + margin-top: 3%; + margin-bottom: 3%; + background-color: #FFF; + display: flex; + flex-direction: column; + align-items: center; } -form#login_form { - padding: 10px 0; +#root { + width: 70%; } .disclaimer { - display: block; - margin-top: 10%; - width: 50%; - margin: auto; - background-color: #2BA6CB; - color: #FFFFFF; - font-weight: 300; - font-size: 0.8rem; - padding: 1em; - margin-bottom: 20px; -} - -.disclaimer li { - margin-top: 1em; + display: block; + width: 90%; + margin: auto; + max-width: 400px; + background-color: #2BA6CB; + color: #FFFFFF; + font-weight: 300; + font-size: 0.8rem; + margin-bottom: 20px; } -.logo { - width: 100%; - height: auto; -} - -input { - display: block; - margin: 10px 0; - padding-left: 5px; +.disclaimer-content { + padding: 1em; } -input.text-field { - width: 97%; -} - -button, .button, input[type=button] { - cursor: pointer; - margin: 0 0 1.25rem; - border: none; - position: relative; - text-decoration: none; - text-align: center; - -webkit-appearance: none; - display: inline-block; - padding: 0.4rem 1.1rem; - font-size: 0.9rem; - background-color: #2ba6cb; - border-color: #2285a2; - color: white; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - -ms-border-radius: 2px; - -o-border-radius: 2px; - border-radius: 2px; +.disclaimer li { + margin-top: 1em; } -button:hover, button:focus, .button:hover, .button:focus, input[type=button]:hover, input[type=button]:focus { - background-color: #2285a2; - outline: none; - color: white; +.logo { + width: 70%; } -ul.accounts { - margin-bottom: 5%; -} +@media only screen and (min-width : 500px) { + body { + font-size: 1.3em; + } -ul.accounts li { - display: inline-block; - list-style: none; - margin-right: 35px; - margin-top: 0px; + .login, .disclaimer { + width: 60%; + } } -ul.accounts li span { - font-weight: bold; +@media only screen and (min-width : 960px) { + .login, .disclaimer { + width: 40%; + } } diff --git a/web-ui/src/login/login.html b/web-ui/src/login/login.html index b3f0f46c..40593096 100644 --- a/web-ui/src/login/login.html +++ b/web-ui/src/login/login.html @@ -18,7 +18,9 @@
-
+
+
+
-- cgit v1.2.3