From 89d9bc0cce020ada664654f18bdfe32b8f5452bb Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Sun, 7 Mar 2021 17:17:16 -0500 Subject: [PATCH] implemented floating labels on inputs & selects, with icons --- assets/js/app.js | 3 +- .../live/user/registration.html.leex | 64 +++++++------- .../live/user/reset_password.html.leex | 58 ++++++------- .../live/user/settings/email.html.leex | 57 +++++++------ .../live/user/settings/password.html.leex | 84 +++++++++---------- .../user_management/form_component.html.leex | 76 +++++++++-------- .../live/user_management/index.html.leex | 10 +-- .../templates/user_confirmation/new.html.eex | 10 +-- .../user_reset_password/new.html.eex | 15 ++-- .../templates/user_session/new.html.eex | 24 +++--- 10 files changed, 199 insertions(+), 202 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 66c975dd..b5943bc8 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -17,9 +17,8 @@ import "../node_modules/bootstrap-icons/icons/at.svg"; // email field import "../node_modules/bootstrap-icons/icons/key.svg"; // new password field import "../node_modules/bootstrap-icons/icons/key-fill.svg"; // pw confirm field import "../node_modules/bootstrap-icons/icons/lock.svg"; // current pw field -import "../node_modules/bootstrap-icons/icons/shield-shaded.svg"; // role +import "../node_modules/bootstrap-icons/icons/shield.svg"; // role // live tables -import "../node_modules/bootstrap-icons/icons/filter.svg"; import "../node_modules/bootstrap-icons/icons/backspace.svg"; // clear filter import "../node_modules/bootstrap-icons/icons/sort-down-alt.svg"; import "../node_modules/bootstrap-icons/icons/sort-up-alt.svg"; diff --git a/lib/shift73k_web/live/user/registration.html.leex b/lib/shift73k_web/live/user/registration.html.leex index f64e057e..511a9666 100644 --- a/lib/shift73k_web/live/user/registration.html.leex +++ b/lib/shift73k_web/live/user/registration.html.leex @@ -9,42 +9,42 @@ <%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, novalidate: true, id: "reg_form"], fn f -> %> -
- <%= label f, :email, class: "form-label" %> -
- - <%= icon_div @socket, "bi-at", [class: "icon"] %> - - <%= email_input f, :email, - value: input_value(f, :email), - class: input_class(f, :email, "form-control"), - placeholder: "e.g., babka@73k.us", - maxlength: User.max_email, - autofocus: true, - phx_debounce: "blur", - aria_describedby: error_ids(f, :email) - %> - <%= error_tag f, :email %> -
+ +
+ <%= email_input f, :email, + value: input_value(f, :email), + class: input_class(f, :email, "form-control"), + placeholder: "e.g., babka@73k.us", + maxlength: User.max_email, + autofocus: true, + phx_debounce: "blur", + aria_describedby: error_ids(f, :email) + %> + <%= label f, :email do %> + <%= icon_div @socket, "bi-at", [class: "icon baseline text-muted"] %> + Email + <% end %> + <%= error_tag f, :email %>
-
- <%= label f, :password, class: "form-label" %> -
- - <%= icon_div @socket, "bi-key", [class: "icon"] %> - - <%= password_input f, :password, - value: input_value(f, :password), - class: input_class(f, :password, "form-control"), - maxlength: User.max_password, - phx_debounce: "250", - aria_describedby: error_ids(f, :password) - %> - <%= error_tag f, :password %> -
+ +
+ <%= password_input f, :password, + value: input_value(f, :password), + class: input_class(f, :password, "form-control"), + placeholder: "Password", + maxlength: User.max_password, + phx_debounce: "250", + aria_describedby: error_ids(f, :password) + %> + <%= label f, :password do %> + <%= icon_div @socket, "bi-key", [class: "icon baseline text-muted"] %> + Password + <% end %> + <%= error_tag f, :password %>
+
<%= submit (@trigger_submit && "Saving..." || "Register"), class: "btn btn-primary", diff --git a/lib/shift73k_web/live/user/reset_password.html.leex b/lib/shift73k_web/live/user/reset_password.html.leex index baae9beb..b29ae36c 100644 --- a/lib/shift73k_web/live/user/reset_password.html.leex +++ b/lib/shift73k_web/live/user/reset_password.html.leex @@ -9,39 +9,39 @@ <%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, novalidate: true, id: "pw_reset_form"], fn f -> %> -
- <%= label f, :password, "New password", class: "form-label" %> -
- - <%= icon_div @socket, "bi-key", [class: "icon"] %> - - <%= password_input f, :password, - value: input_value(f, :password), - class: input_class(f, :password, "form-control"), - maxlength: User.max_password, - autofocus: true, - aria_describedby: error_ids(f, :password) - %> - <%= error_tag f, :password %> -
+
+ <%= password_input f, :password, + value: input_value(f, :password), + class: input_class(f, :password, "form-control"), + placeholder: "New Password", + maxlength: User.max_password, + autofocus: true, + aria_describedby: error_ids(f, :password) + %> + <%= label f, :password do %> + <%= icon_div @socket, "bi-key", [class: "icon baseline text-muted"] %> + New password + <% end %> + <%= error_tag f, :password %>
-
- <%= label f, :password_confirmation, "Confirm new password", class: "form-label" %> -
- - <%= icon_div @socket, "bi-key-fill", [class: "icon"] %> - - <%= password_input f, :password_confirmation, - value: input_value(f, :password_confirmation), - class: input_class(f, :password_confirmation, "form-control"), - maxlength: User.max_password, - aria_describedby: error_ids(f, :password_confirmation) - %> - <%= error_tag f, :password_confirmation %> -
+ +
+ <%= password_input f, :password_confirmation, + value: input_value(f, :password_confirmation), + class: input_class(f, :password_confirmation, "form-control"), + placeholder: "Confirm new password", + maxlength: User.max_password, + aria_describedby: error_ids(f, :password_confirmation) + %> + <%= label f, :password do %> + <%= icon_div @socket, "bi-key-fill", [class: "icon baseline text-muted"] %> + Confirm new password + <% end %> + <%= error_tag f, :password_confirmation %>
+
<%= submit "Reset password", class: "btn btn-primary", diff --git a/lib/shift73k_web/live/user/settings/email.html.leex b/lib/shift73k_web/live/user/settings/email.html.leex index 8016cd85..2d1b6e47 100644 --- a/lib/shift73k_web/live/user/settings/email.html.leex +++ b/lib/shift73k_web/live/user/settings/email.html.leex @@ -4,40 +4,39 @@ <%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, phx_target: @myself], fn f -> %> -
- <%= label f, :email, class: "form-label" %> -
- - <%= icon_div @socket, "bi-at", [class: "icon"] %> - - <%= email_input f, :email, - value: input_value(f, :email), - class: input_class(f, :email, "form-control"), - placeholder: "e.g., babka@73k.us", - maxlength: User.max_email, - phx_debounce: "500", - aria_describedby: error_ids(f, :email) - %> - <%= error_tag f, :email %> -
+ +
+ <%= email_input f, :email, + value: input_value(f, :email), + class: input_class(f, :email, "form-control"), + placeholder: "e.g., babka@73k.us", + maxlength: User.max_email, + phx_debounce: "500", + aria_describedby: error_ids(f, :email) + %> + <%= label f, :email do %> + <%= icon_div @socket, "bi-at", [class: "icon baseline text-muted"] %> + Email + <% end %> + <%= error_tag f, :email %>
-
- <%= label f, :current_password, class: "form-label" %> -
- - <%= icon_div @socket, "bi-lock", [class: "icon"] %> - - <%= password_input f, :current_password, - value: input_value(f, :current_password), - class: "form-control", - aria_describedby: error_ids(f, :current_password) - %> - <%= error_tag f, :current_password %> -
+
+ <%= password_input f, :current_password, + value: input_value(f, :current_password), + class: "form-control", + placeholder: "Current Password", + aria_describedby: error_ids(f, :current_password) + %> + <%= label f, :current_password do %> + <%= icon_div @socket, "bi-lock", [class: "icon baseline text-muted"] %> + Current password + <% end %> + <%= error_tag f, :current_password %>
+
<%= submit "Change email", class: "btn btn-primary", diff --git a/lib/shift73k_web/live/user/settings/password.html.leex b/lib/shift73k_web/live/user/settings/password.html.leex index b216f15c..6d781dfd 100644 --- a/lib/shift73k_web/live/user/settings/password.html.leex +++ b/lib/shift73k_web/live/user/settings/password.html.leex @@ -4,52 +4,52 @@ <%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, phx_target: @myself], fn f -> %> -
- <%= label f, :password, "New password", class: "form-label" %> -
- - <%= icon_div @socket, "bi-key", [class: "icon"] %> - - <%= password_input f, :password, - value: input_value(f, :password), - class: input_class(f, :password, "form-control"), - maxlength: User.max_password, - phx_debounce: "500", - aria_describedby: error_ids(f, :password) - %> - <%= error_tag f, :password %> -
+ +
+ <%= password_input f, :password, + value: input_value(f, :password), + class: input_class(f, :password, "form-control"), + placeholder: "New Password", + maxlength: User.max_password, + phx_debounce: "500", + aria_describedby: error_ids(f, :password) + %> + <%= label f, :password do %> + <%= icon_div @socket, "bi-key", [class: "icon baseline text-muted"] %> + New password + <% end %> + <%= error_tag f, :password %>
-
- <%= label f, :password_confirmation, "Confirm new password", class: "form-label" %> -
- - <%= icon_div @socket, "bi-key-fill", [class: "icon"] %> - - <%= password_input f, :password_confirmation, - value: input_value(f, :password_confirmation), - class: input_class(f, :password_confirmation, "form-control"), - maxlength: User.max_password, - aria_describedby: error_ids(f, :password_confirmation) - %> - <%= error_tag f, :password_confirmation %> -
+ +
+ <%= password_input f, :password_confirmation, + value: input_value(f, :password_confirmation), + class: input_class(f, :password_confirmation, "form-control"), + placeholder: "Confirm new password", + maxlength: User.max_password, + aria_describedby: error_ids(f, :password_confirmation) + %> + <%= label f, :password_confirmation do %> + <%= icon_div @socket, "bi-key-fill", [class: "icon baseline text-muted"] %> + Confirm new password + <% end %> + <%= error_tag f, :password_confirmation %>
-
- <%= label f, :current_password, class: "form-label" %> -
- - <%= icon_div @socket, "bi-lock", [class: "icon"] %> - - <%= password_input f, :current_password, - value: input_value(f, :current_password), - class: "form-control", - aria_describedby: error_ids(f, :current_password) - %> - <%= error_tag f, :current_password %> -
+ +
+ <%= password_input f, :current_password, + value: input_value(f, :current_password), + class: "form-control", + placeholder: "Current Password", + aria_describedby: error_ids(f, :current_password) + %> + <%= label f, :current_password do %> + <%= icon_div @socket, "bi-lock", [class: "icon baseline text-muted"] %> + Current password + <% end %> + <%= error_tag f, :current_password %>
diff --git a/lib/shift73k_web/live/user_management/form_component.html.leex b/lib/shift73k_web/live/user_management/form_component.html.leex index 92a10f7e..65607c0c 100644 --- a/lib/shift73k_web/live/user_management/form_component.html.leex +++ b/lib/shift73k_web/live/user_management/form_component.html.leex @@ -6,32 +6,49 @@