Animated generate button

This commit is contained in:
Sage Vaillancourt 2022-09-23 13:22:27 +00:00
parent 76a61f69e0
commit 28c84a05cb
2 changed files with 56 additions and 9 deletions

View File

@ -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%;
}

View File

@ -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 @@
<h2>The secret cover letter generator</h2>
{% from "_formhelpers.jinja2" import render_field %}
<form method=post>
<form method=post id="letter-form">
<dl>
{{ render_field(form.username) }}
{{ render_field(form.company) }}
@ -62,14 +68,14 @@
</div>
{% endif %}
<input
class=submit
type=submit
value="Generate PDF"
<a href="javascript:void(0)"
class="wipe up-wipe"
{% if errors %}
onclick="clearErrors()"
onclick="clearErrors();document.getElementById('letter-form').submit()"
{% else %}
onclick="document.getElementById('letter-form').submit()"
{% endif %}
>
>Generate PDF</a>
</form>
</body>