From 28c84a05cb5bbdf89e685b296051709d63633cb2 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 23 Sep 2022 13:22:27 +0000 Subject: [PATCH] Animated generate button --- flaskr/static/styles.css | 43 ++++++++++++++++++++++++++++++++- flaskr/templates/writing.jinja2 | 22 +++++++++++------ 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/flaskr/static/styles.css b/flaskr/static/styles.css index 8696015..0a24608 100644 --- a/flaskr/static/styles.css +++ b/flaskr/static/styles.css @@ -145,7 +145,7 @@ textarea { color: #a40f0f; } -.submit { +.wipe { margin-left: auto; padding: 0.5em 1em 0.5em 1em; } @@ -153,3 +153,44 @@ textarea { #body { flex-grow: 1; } + +.wipe { + padding: 10px 25px; + font-family: "Roboto", sans-serif; + font-weight: 500; + background: black; + outline: none !important; + cursor: pointer; + transition: all 0.3s ease; + position: relative; + display: inline-block; + text-decoration: none; +} + +.up-wipe { + border: 2px solid rgb(255, 255, 255); + z-index: 1; + color: white; +} + +.up-wipe:after { + position: absolute; + content: ""; + width: 100%; + height: 0; + top: 0; + left: 0; + z-index: -1; + background: rgb(255, 255, 255); + transition: all 0.3s ease; +} + +.up-wipe:hover { + color: rgb(0, 0, 0); +} + +.up-wipe:hover:after { + top: auto; + bottom: 0; + height: 100%; +} diff --git a/flaskr/templates/writing.jinja2 b/flaskr/templates/writing.jinja2 index 4a62838..7371c03 100644 --- a/flaskr/templates/writing.jinja2 +++ b/flaskr/templates/writing.jinja2 @@ -18,7 +18,13 @@ } decodeURIComponent(document.cookie).split(';').forEach(cookie => { [id, value] = cookie.trim().split('=') - document.getElementById(id).value = value + if (!id || !value) { + return + } + const e = document.getElementById(id) + if (e) { + e.value = value + } }) } @@ -36,7 +42,7 @@

The secret cover letter generator

{% from "_formhelpers.jinja2" import render_field %} -
+
{{ render_field(form.username) }} {{ render_field(form.company) }} @@ -62,14 +68,14 @@ {% endif %} - + >Generate PDF