diff --git a/src/ui/web/css/form.css b/src/ui/web/css/form.css index 14dba7f3..741d2bfd 100644 --- a/src/ui/web/css/form.css +++ b/src/ui/web/css/form.css @@ -15,10 +15,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -.form > div { - margin: 0.4em 0; -} - .form input { display: block; width: 100%; diff --git a/src/ui/web/css/login.css b/src/ui/web/css/login.css index 4df1ac22..1032ead0 100644 --- a/src/ui/web/css/login.css +++ b/src/ui/web/css/login.css @@ -28,7 +28,6 @@ limitations under the License. .SessionPickerView li { margin: 0.4em 0; - padding: 0.5em; } .SessionPickerView .session-info { diff --git a/src/ui/web/css/themes/element/theme.css b/src/ui/web/css/themes/element/theme.css index 57b0da51..f11c47b3 100644 --- a/src/ui/web/css/themes/element/theme.css +++ b/src/ui/web/css/themes/element/theme.css @@ -72,6 +72,22 @@ limitations under the License. flex: 1 0 auto; } +.form-row { + margin: 12px 0; +} + +.form-row input { + padding: 12px; + border: 1px solid rgba(141, 151, 165, 0.15); + border-radius: 8px; + margin-top: 5px; + font-size: 1em; +} + +.form-row label, .form-row input { + display: block; +} + button.styled.secondary { color: #03B381; } diff --git a/src/ui/web/general/html.js b/src/ui/web/general/html.js index 421b04b7..846539c7 100644 --- a/src/ui/web/general/html.js +++ b/src/ui/web/general/html.js @@ -94,7 +94,7 @@ export const TAG_NAMES = { [HTML_NS]: [ "a", "ol", "ul", "li", "div", "h1", "h2", "h3", "h4", "h5", "h6", "p", "strong", "em", "span", "img", "section", "main", "article", "aside", - "pre", "button", "time", "input", "textarea"], + "pre", "button", "time", "input", "textarea", "label"], [SVG_NS]: ["svg", "circle"] }; diff --git a/src/ui/web/login/LoginView.js b/src/ui/web/login/LoginView.js index 55dd0f8c..ef2afbb6 100644 --- a/src/ui/web/login/LoginView.js +++ b/src/ui/web/login/LoginView.js @@ -21,23 +21,49 @@ import {SessionLoadView} from "./SessionLoadView.js"; export class LoginView extends TemplateView { render(t, vm) { const disabled = vm => !!vm.isBusy; - const username = t.input({type: "text", placeholder: vm.i18n`Username`, disabled}); - const password = t.input({type: "password", placeholder: vm.i18n`Password`, disabled}); - const homeserver = t.input({type: "text", placeholder: vm.i18n`Your matrix homeserver`, value: vm.defaultHomeServer, disabled}); - return t.div({className: "LoginView form"}, [ - t.h1([vm.i18n`Log in to your homeserver`]), - t.if(vm => vm.error, t.createTemplate(t => t.div({className: "error"}, vm => vm.error))), - t.div(username), - t.div(password), - t.div(homeserver), - t.div(t.button({ - onClick: () => vm.login(username.value, password.value, homeserver.value), - disabled - }, vm.i18n`Log In`)), - t.div(t.button({onClick: () => vm.cancel(), disabled}, [vm.i18n`Pick an existing session`])), - // use t.mapView rather than t.if to create a new view when the view model changes too - t.mapView(vm => vm.loadViewModel, loadViewModel => loadViewModel ? new SessionLoadView(loadViewModel) : null), - t.p(hydrogenGithubLink(t)) + const username = t.input({ + id: "username", + type: "text", + placeholder: vm.i18n`Username`, + disabled + }); + const password = t.input({ + id: "password", + type: "password", + placeholder: vm.i18n`Password`, + disabled + }); + const homeserver = t.input({ + id: "homeserver", + type: "text", + placeholder: vm.i18n`Your matrix homeserver`, + value: vm.defaultHomeServer, + disabled + }); + + return t.div({className: "PreSessionScreen"}, [ + t.div({className: "logo"}), + t.div({className: "LoginView form"}, [ + t.h1([vm.i18n`Sign In`]), + t.if(vm => vm.error, t.createTemplate(t => t.div({className: "error"}, vm => vm.error))), + t.div({className: "form-row"}, [t.label({for: "username"}, vm.i18n`Username`), username]), + t.div({className: "form-row"}, [t.label({for: "password"}, vm.i18n`Password`), password]), + t.div({className: "form-row"}, [t.label({for: "homeserver"}, vm.i18n`Homeserver`), homeserver]), + t.mapView(vm => vm.loadViewModel, loadViewModel => loadViewModel ? new SessionLoadView(loadViewModel) : null), + t.div({className: "button-row"}, [ + t.button({ + className: "styled secondary", + onClick: () => vm.cancel(), disabled + }, [vm.i18n`Go Back`]), + t.button({ + className: "styled primary", + onClick: () => vm.login(username.value, password.value, homeserver.value), + disabled + }, vm.i18n`Log In`), + ]), + // use t.mapView rather than t.if to create a new view when the view model changes too + t.p(hydrogenGithubLink(t)) + ]) ]); } }