♻️ Add tagline and some refactor to login page

This commit is contained in:
Eva Marco 2024-03-22 16:45:51 +01:00
parent 3d6eb9d4bb
commit 30e1c3b4ff
18 changed files with 147 additions and 113 deletions

View file

@ -30,7 +30,7 @@
[:a {:href cf/terms-of-service-uri :target "_blank"} (tr "auth.terms-of-service")])
(when show-all?
[:span (tr "labels.and")])
[:span (dm/str " " (tr "labels.and") " ")])
(when show-privacy?
[:a {:href cf/privacy-policy-uri :target "_blank"} (tr "auth.privacy-policy")])])))
@ -45,11 +45,12 @@
(dom/set-html-title (tr "title.default")))
[:main {:class (stl/css :auth-section)}
[:a {:href "#/" :class (stl/css :logo-btn)} i/logo]
[:div {:class (stl/css :login-illustration)}
i/login-illustration]
[:section {:class (stl/css :auth-content)}
[:a {:href "#/" :class (stl/css :logo-btn)} i/logo]
(case section
:auth-register
[:& register-page {:params params}]
@ -69,6 +70,5 @@
:auth-recovery
[:& recovery-page {:params params}])
(when (or (= section :auth-login)
(= section :auth-register))
(when (= section :auth-register)
[:& terms-login])]]))

View file

@ -7,6 +7,7 @@
@use "common/refactor/common-refactor.scss" as *;
.auth-section {
position: relative;
align-items: center;
background: var(--panel-background-color);
display: grid;
@ -43,8 +44,9 @@
.auth-content {
grid-column: 4 / 6;
display: flex;
flex-direction: column;
display: grid;
grid-template-rows: 1fr auto;
gap: $s-24;
height: fit-content;
max-width: $s-412;
padding-bottom: $s-8;
@ -53,6 +55,9 @@
}
.logo-btn {
position: absolute;
top: $s-20;
left: $s-20;
display: flex;
justify-content: flex-start;
margin-bottom: $s-52;
@ -68,8 +73,6 @@
.terms-login {
font-size: $fs-11;
position: absolute;
bottom: 0;
width: 100%;
display: flex;
gap: $s-4;
@ -77,7 +80,10 @@
a {
font-weight: $fw700;
color: $df-secondary;
color: $da-primary;
&:hover {
text-decoration: underline;
}
}
span {
border-bottom: $s-1 solid transparent;

View file

@ -6,21 +6,21 @@
@use "common/refactor/common-refactor.scss" as *;
.auth-form {
.auth-form-wrapper {
width: 100%;
padding-block-end: $s-16;
padding-block-end: 0;
display: grid;
gap: $s-24;
form {
display: flex;
flex-direction: column;
gap: $s-12;
margin-block-end: $s-24;
}
}
.separator {
border-color: $db-quaternary;
margin: $s-24 0;
margin: 0;
}
.error-wrapper {
@ -33,11 +33,16 @@
}
.auth-subtitle {
margin-top: $s-24;
font-size: $fs-14;
color: $df-secondary;
}
.auth-tagline {
@include smallTitleTipography;
margin: 0;
color: $df-secondary;
}
.form-field {
--input-width: 100%;
--input-height: #{$s-40};
@ -63,7 +68,6 @@
display: flex;
flex-direction: column;
gap: $s-12;
padding: $s-24 0;
border-top: $s-1 solid $db-quaternary;
span {
@ -77,8 +81,49 @@
text-transform: uppercase;
font-size: $fs-11;
}
&.register a {
@extend .button-primary;
}
.go-back {
border-top: none;
}
.demo-account {
padding: 0;
border-top: none;
}
.links {
display: grid;
gap: $s-24;
}
.register,
.account {
display: flex;
justify-content: center;
gap: $s-8;
padding: 0;
}
.register-text,
.account-text {
text-align: right;
font-size: $fs-14;
color: $df-secondary;
}
.register-link,
.account-link {
text-align: left;
background-color: transparent;
border: none;
display: inline;
font-size: $fs-14;
color: $da-primary;
font-weight: $fw400;
&:hover {
text-decoration: underline;
}
}
@ -87,9 +132,12 @@
justify-content: flex-end;
a {
font-size: $fs-14;
color: $df-secondary;
color: $da-primary;
font-weight: $fw400;
}
&:hover {
text-decoration: underline;
}
}
.submit-btn,
@ -109,13 +157,15 @@
align-items: center;
gap: $s-6;
width: 100%;
background-color: $db-tertiary;
color: var(--app-white);
span {
padding-top: $s-2;
}
&:hover {
color: var(--app-white);
background-color: $db-quaternary;
}
}
@ -124,38 +174,6 @@
gap: $s-8;
}
.btn-google-auth {
color: var(--google-login-foreground);
background-color: var(--google-login-background);
&:hover {
background: var(--google-login-background-hover);
}
}
.btn-github-auth {
color: var(--github-login-foreground);
background: var(--github-login-background);
&:hover {
background: var(--github-login-background-hover);
}
}
.btn-oidc-auth {
color: var(--oidc-login-foreground);
background: var(--oidc-login-background);
&:hover {
background: var(--oidc-login-background-hover);
}
}
.btn-gitlab-auth {
color: var(--gitlab-login-foreground);
background: var(--gitlab-login-background);
&:hover {
background: var(--gitlab-login-background-hover);
}
}
.banner {
margin: $s-16 0;
}

View file

@ -173,7 +173,9 @@
:data-test "login-banner"
:role "alert"}]])
[:& fm/form {:on-submit on-submit :form form}
[:& fm/form {:on-submit on-submit
:class (stl/css :login-form)
:form form}
[:div {:class (stl/css :fields-row)}
[:& fm/input
{:name :email
@ -255,11 +257,11 @@
(when (k/enter? event)
(login-oidc event))))]
(when (contains? cf/flags :login-with-oidc)
[:div {:class (stl/css :link-entry :link-oidc)}
[:a {:tab-index "0"
:on-key-down handle-key-down
:on-click login-oidc}
(tr "auth.login-with-oidc-submit")]])))
[:button {:tab-index "0"
:class (stl/css :link-entry :link-oidc)
:on-key-down handle-key-down
:on-click login-oidc}
(tr "auth.login-with-oidc-submit")])))
(mf/defc login-methods
[{:keys [params on-success-callback origin] :as props}]
@ -282,35 +284,29 @@
[{:keys [params] :as props}]
(let [go-register
(mf/use-fn
#(st/emit! (rt/nav :auth-register {} params)))
#(st/emit! (rt/nav :auth-register {} params)))]
on-create-demo-profile
(mf/use-fn
#(st/emit! (du/create-demo-profile)))]
[:div {:class (stl/css :auth-form)}
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)
:data-test "login-title"} (tr "auth.login-title")]
:data-test "login-title"} (tr "auth.login-account-title")]
[:p {:class (stl/css :auth-tagline)}
(tr "auth.login-tagline")]
(when (contains? cf/flags :demo-warning)
[:& demo-warning])
[:hr {:class (stl/css :separator)}]
[:& login-methods {:params params}]
[:hr {:class (stl/css :separator)}]
[:div {:class (stl/css :links)}
(when (contains? cf/flags :registration)
[:div {:class (stl/css :link-entry :register)}
[:span (tr "auth.register") " "]
[:div {:class (stl/css :register)}
[:span {:class (stl/css :register-text)}
(tr "auth.register") " "]
[:& lk/link {:action go-register
:class (stl/css :register-link)
:data-test "register-submit"}
(tr "auth.register-submit")]])]
(when (contains? cf/flags :demo-users)
[:div {:class (stl/css :link-entry :demo-account)}
[:span (tr "auth.create-demo-profile") " "]
[:& lk/link {:action on-create-demo-profile
:data-test "demo-account-link"}
(tr "auth.create-demo-account")]])]))
(tr "auth.register-submit")]])]]))

View file

@ -61,7 +61,9 @@
(fm/validate-not-empty :password-1 (tr "auth.password-not-empty"))
(fm/validate-not-empty :password-2 (tr "auth.password-not-empty"))]
:initial params)]
[:& fm/form {:on-submit on-submit :form form}
[:& fm/form {:on-submit on-submit
:class (stl/css :recovery-form)
:form form}
[:div {:class (stl/css :fields-row)}
[:& fm/input {:type "password"
:name :password-1
@ -84,13 +86,13 @@
(mf/defc recovery-page
[{:keys [params] :as props}]
[:div {:class (stl/css :auth-form)}
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)} "Forgot your password?"]
[:div {:class (stl/css :auth-subtitle)} "Please enter your new password"]
[:hr {:class (stl/css :separator)}]
[:& recovery-form {:params params}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:div {:class (stl/css :link-entry :go-back)}
[:a {:on-click #(st/emit! (rt/nav :auth-login))}
(tr "profile.recovery.go-to-login")]]]])

View file

@ -76,6 +76,7 @@
(st/emit! (du/request-profile-recovery params)))))]
[:& fm/form {:on-submit on-submit
:class (stl/css :recovery-request-form)
:form form}
[:div {:class (stl/css :fields-row)}
[:& fm/input {:name :email
@ -95,14 +96,14 @@
[{:keys [params on-success-callback go-back-callback] :as props}]
(let [default-go-back #(st/emit! (rt/nav :auth-login))
go-back (or go-back-callback default-go-back)]
[:div {:class (stl/css :auth-form)}
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)} (tr "auth.recovery-request-title")]
[:div {:class (stl/css :auth-subtitle)} (tr "auth.recovery-request-subtitle")]
[:hr {:class (stl/css :separator)}]
[:& recovery-form {:params params :on-success-callback on-success-callback}]
[:div {:class (stl/css :link-entry)}
[:hr {:class (stl/css :separator)}]
[:div {:class (stl/css :link-entry :go-back)}
[:& lk/link {:action go-back
:data-test "go-back-link"}
(tr "labels.go-back")]]]))

View file

@ -132,19 +132,18 @@
[{:keys [params on-success-callback]}]
[:*
(when login/show-alt-login-buttons?
[:*
[:hr {:class (stl/css :separator)}]
[:& login/login-buttons {:params params}]])
[:& login/login-buttons {:params params}])
[:hr {:class (stl/css :separator)}]
[:& register-form {:params params :on-success-callback on-success-callback}]])
(mf/defc register-page
{::mf/props :obj}
[{:keys [params]}]
[:div {:class (stl/css :auth-form)}
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)
:data-test "registration-title"} (tr "auth.register-title")]
[:div {:class (stl/css :auth-subtitle)} (tr "auth.register-subtitle")]
[:p {:class (stl/css :auth-tagline)}
(tr "auth.login-tagline")]
(when (contains? cf/flags :demo-warning)
[:& login/demo-warning])
@ -152,18 +151,20 @@
[:& register-methods {:params params}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry :account)}
[:span (tr "auth.already-have-account") " "]
[:div {:class (stl/css :account)}
[:span {:class (stl/css :account-text)} (tr "auth.already-have-account") " "]
[:& lk/link {:action #(st/emit! (rt/nav :auth-login {} params))
:class (stl/css :account-link)
:data-test "login-here-link"}
(tr "auth.login-here")]]
(when (contains? cf/flags :demo-users)
[:div {:class (stl/css :link-entry :demo-users)}
[:span (tr "auth.create-demo-profile") " "]
[:& lk/link {:action #(st/emit! (du/create-demo-profile))}
(tr "auth.create-demo-account")]])]])
[:*
[:hr {:class (stl/css :separator)}]
[:div {:class (stl/css :link-entry :demo-account)}
[:& lk/link {:action #(st/emit! (du/create-demo-profile))}
(tr "auth.create-demo-account")]]])]])
;; --- PAGE: register validation
@ -228,7 +229,8 @@
(rx/subs! on-success
(partial handle-register-error form))))))]
[:& fm/form {:on-submit on-submit :form form}
[:& fm/form {:on-submit on-submit :form form
:class (stl/css :register-validate-form)}
[:div {:class (stl/css :fields-row)}
[:& fm/input {:name :fullname
:label (tr "auth.fullname")
@ -258,7 +260,7 @@
(mf/defc register-validate-page
[{:keys [params]}]
[:div {:class (stl/css :auth-form)}
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)
:data-test "register-title"} (tr "auth.register-title")]
[:div {:class (stl/css :auth-subtitle)} (tr "auth.register-subtitle")]
@ -274,7 +276,7 @@
(mf/defc register-success-page
[{:keys [params]}]
[:div {:class (stl/css :auth-form :register-success)}
[:div {:class (stl/css :auth-form-wrapper :register-success)}
[:div {:class (stl/css :notification-icon)} i/icon-verify]
[:div {:class (stl/css :notification-text)} (tr "auth.verification-email-sent")]
[:div {:class (stl/css :notification-text-email)} (:email params "")]

View file

@ -50,7 +50,6 @@
cursor: pointer;
color: var(--modal-title-foreground-color);
text-transform: uppercase;
margin-bottom: $s-8;
input {
@extend .input-element;
color: var(--input-foreground-color-active);
@ -144,8 +143,9 @@
.hint {
@include bodySmallTypography;
color: var(--modal-text-foreground-color);
width: 99%;
margin-block-start: $s-8;
color: var(--modal-text-foreground-color);
}
.checkbox {

View file

@ -37,6 +37,7 @@
.group-name-input {
@extend .input-element-label;
margin-bottom: $s-8;
label {
@include flexColumn;
@include bodySmallTypography;

View file

@ -127,6 +127,7 @@
height: $s-32;
width: calc(100% - $s-24);
margin-inline-start: $s-24;
margin-block-end: $s-8;
}
// STEP-4

View file

@ -84,11 +84,11 @@
[:div {:class (stl/css :form-container)}
[:& login-methods {:on-success-callback success-login :origin :viewer}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:div {:class (stl/css :link-entry :recovery-request)}
[:a {:on-click set-section
:data-value "recovery-request"}
(tr "auth.forgot-password")]]
[:div {:class (stl/css :link-entry)}
[:div {:class (stl/css :link-entry :register)}
[:span (tr "auth.register") " "]
[:a {:on-click set-section
:data-value "register"}
@ -98,7 +98,7 @@
[:div {:class (stl/css :form-container)}
[:& register-methods {:on-success-callback success-register}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:div {:class (stl/css :link-entry :account)}
[:span (tr "auth.already-have-account") " "]
[:a {:on-click set-section
:data-value "login"}
@ -109,7 +109,7 @@
[:& register-validate-form {:params {:token @register-token}
:on-success-callback success-email-sent}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:div {:class (stl/css :link-entry :register)}
[:a {:on-click set-section
:data-value "register"}
(tr "labels.go-back")]]]]

View file

@ -49,6 +49,7 @@
}
.input-wrapper {
@extend .input-with-label;
margin-bottom: $s-8;
}
.action-buttons {
@extend .modal-action-btns;