stubbed in signup dialog

This commit is contained in:
Danny Coates 2018-09-27 15:46:46 -07:00
parent d560fc05cf
commit f7f8944e00
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
7 changed files with 85 additions and 6 deletions

View File

@ -17,6 +17,7 @@
@import './templates/popup/popup.css';
@import './templates/selectbox/selectbox.css';
@import './templates/setPasswordSection/setPasswordSection.css';
@import './templates/signupDialog/signupDialog.css';
@import './templates/signupPromo/signupPromo.css';
@import './templates/title/title.css';
@import './templates/uploadedFile/uploadedFile.css';

View File

@ -3,7 +3,7 @@ const html = require('choo/html');
const raw = require('choo/html/raw');
const selectbox = require('../selectbox');
const timeLimitText = require('../timeLimitText');
const okDialog = require('../okDialog');
const signupDialog = require('../signupDialog');
module.exports = function(state, emit) {
const el = html`<div> ${raw(
@ -31,7 +31,7 @@ module.exports = function(state, emit) {
value => {
const max = state.user.maxDownloads;
if (value > max) {
state.modal = okDialog('todo: this setting requires an account');
state.modal = signupDialog();
value = max;
}
state.downloadCount = value;
@ -54,7 +54,7 @@ module.exports = function(state, emit) {
value => {
const max = state.user.maxExpireSeconds;
if (value > max) {
state.modal = okDialog('todo: this setting requires an account');
state.modal = signupDialog();
value = max;
}
state.timeLimit = value;

View File

@ -4,7 +4,7 @@ module.exports = function(state, emit) {
return html`
<div class="modal" onclick=${close}>
<div class="modal__box" onclick=${e => e.stopPropagation()}>
${state.modal(state, close)}
${state.modal(state, emit, close)}
</div>
</div>`;

View File

@ -15,7 +15,6 @@
.modal__box {
max-width: 480px;
max-height: 300px;
background: var(--pageBGColor);
border-radius: 4px;
color: var(--textColor);

View File

@ -1,7 +1,7 @@
const html = require('choo/html');
module.exports = function(message) {
return function(state, close) {
return function(state, emit, close) {
return html`
<div class="okDialog">
<div class="okDialog__message">${message}</div>

View File

@ -0,0 +1,57 @@
/* globals LIMITS */
const html = require('choo/html');
const bytes = require('../../utils').bytes;
// TODO: there's some duplication here with the signin page
module.exports = function() {
return function(state, emit, close) {
return html`
<div class="signupDialog">
<div class="signupDialog__message">
${state.translate('accountBenefitTitle')}
<ul>
<li>${state.translate('accountBenefitLargeFiles', {
size: bytes(LIMITS.MAX_FILE_SIZE)
})}</li>
<li>${state.translate('accountBenefitExpiry')}</li>
<li>${state.translate('accountBenefitSync')}</li>
</ul>
</div>
<form
onsubmit=${submitEmail}
data-no-csrf>
<input
id="email-input"
type="text"
class="signupDialog__emailInput"
placeholder=${state.translate('emailEntryPlaceholder')}/>
<input
class='noDisplay'
id="email-submit"
type="submit"/>
</form>
<label class="btn" for="email-submit">
${state.translate('signInMenuOption')}
</label>
<button
class="btn--cancel"
title="${state.translate('deletePopupCancel')}"
onclick=${close}>${state.translate('deletePopupCancel')}
</button>
</div>`;
function submitEmail(event) {
event.preventDefault();
const el = document.getElementById('email-input');
const email = el.value;
if (email) {
// just check if it's the right shape
const a = email.split('@');
if (a.length === 2 && a.every(s => s.length > 0)) {
return emit('login', email);
}
}
el.value = '';
}
};
};

View File

@ -0,0 +1,22 @@
.signupDialog {
display: flex;
flex-direction: column;
max-width: 400px;
padding: 16px;
}
.signupDialog__message {
margin: 32px 32px 0 32px;
}
.signupDialog__emailInput {
box-sizing: border-box;
height: 40px;
width: 100%;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px;
margin: 16px 0;
padding: 0 8px;
font-size: 18px;
color: var(--lightTextColor);
}