Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 22 additions & 27 deletions app/assets/stylesheets/components/_password.scss
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
@use 'uswds-core' as *;

$weak: #e80e0e;
$average: #ffac00;
$good: #9ac056;
$great: #00b200;

.pw-bar {
background-color: #e9e9e9;
border: units(0.5) solid #fff;
border-radius: 6px;
float: left;
height: 16px;
width: 25%;
.password-strength__meter {
display: flex;
margin-top: units(1);
margin-bottom: units(0.5);
}

.pw-weak {
.pw-bar:nth-child(-n + 1) {
background-color: $weak;
.password-strength__meter-bar {
flex-basis: 25%;
background-color: color('base-lighter');
border-radius: 2px;
height: units(1);

& + & {
margin-left: units(1);
}
}

.pw-average {
.pw-bar:nth-child(-n + 2) {
background-color: $average;
.pw-weak &:nth-child(-n + 1) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like pw-weak , etc are defined in packs/pw-strength.js, should we update that to use the expanded password-strength__weak style or just leave it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I've got a lot more planned here for follow-on pull requests, and this is one of them. The problem I've had with password strength is that every time I've tried to touch it in the past, I end up doing a major overhaul, so I'm trying to do this a little more incrementally this time 😅

background-color: color('error');
}
}

.pw-good {
.pw-bar:nth-child(-n + 3) {
background-color: $good;
.pw-average &:nth-child(-n + 2) {
background-color: color('warning');
}

.pw-good &:nth-child(-n + 3) {
background-color: color('success-light');
}
}

.pw-great {
.pw-bar {
background-color: $great;
.pw-great &:nth-child(-n + 4) {
background-color: color('success');
}
}
10 changes: 5 additions & 5 deletions app/views/devise/shared/_password_strength.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div id='pw-strength-cntnr' class='display-none' aria-live='polite' aria-atomic='true' data-pw-min-length='<%= Devise.password_length.min %>'>
<div class="margin-bottom-4">
<div class='clearfix margin-x-neg-05 padding-top-05'>
<div class='pw-bar'></div>
<div class='pw-bar'></div>
<div class='pw-bar'></div>
<div class='pw-bar'></div>
<div class="password-strength__meter">
<div class="password-strength__meter-bar"></div>
<div class="password-strength__meter-bar"></div>
<div class="password-strength__meter-bar"></div>
<div class="password-strength__meter-bar"></div>
</div>
<div class='h5'>
<%= t('instructions.password.strength.intro') %>
Expand Down