updated download password input style

This commit is contained in:
Danny Coates 2018-02-20 12:21:00 -08:00
parent 130ddca135
commit ebecc6bb81
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 16 additions and 8 deletions

View File

@ -11,8 +11,12 @@
padding: 10px 0;
}
.red {
color: red;
.error {
color: var(--errorColor);
}
.input--error {
border-color: var(--errorColor);
}
@media (max-device-width: 520px), (max-width: 520px) {

View File

@ -2,22 +2,25 @@ const html = require('choo/html');
module.exports = function(state, emit) {
const fileInfo = state.fileInfo;
const label =
fileInfo.password === null
? html`
<label class="red" for="password-input">
const invalid = fileInfo.password === null;
const label = invalid
? html`
<label class="error" for="password-input">
${state.translate('passwordTryAgain')}
</label>`
: html`
: html`
<label for="password-input">
${state.translate('unlockInputLabel')}
</label>`;
const inputClass = invalid
? 'input input--noBtn input--error'
: 'input input--noBtn';
const div = html`
<div class="passwordSection">
${label}
<form class="passwordForm" onsubmit=${checkPassword} data-no-csrf>
<input id="password-input"
class="input input--noBtn"
class="${inputClass}"
maxlength="64"
autocomplete="off"
placeholder="${state.translate('unlockInputPlaceholder')}"
@ -37,6 +40,7 @@ module.exports = function(state, emit) {
function inputChanged() {
const input = document.getElementById('password-input');
const btn = document.getElementById('password-btn');
input.classList.remove('input--error');
if (input.value.length > 0) {
btn.classList.remove('inputBtn--hidden');
input.classList.remove('input--noBtn');