Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add spinner to Check Status button #1043

Closed
wants to merge 3 commits into from
Closed
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
13 changes: 9 additions & 4 deletions benefits/core/templates/core/includes/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@
{% endif %}
<div class="col-lg-3 offset-2 offset-sm-2 offset-lg-0 col-sm-8 col-8">
{% if recaptcha.enabled %}
<button class="btn btn-lg btn-primary g-recaptcha"
<button class="btn btn-lg btn-primary spinner-hidden d-flex justify-content-center align-items-center g-recaptcha"
data-sitekey="{{ recaptcha.site_key }}"
data-callback="onSubmit"
data-action="submit">
{{ form.submit_value }}
<span class="btn-text">{{ form.submit_value }}</span>
<span class="spinner-border spinner-border-sm" role="status"></span>
</button>
{% else %}
<button class="btn btn-lg btn-primary" data-action="submit">{{ form.submit_value }}</button>
<button class="btn btn-lg btn-primary spinner-hidden d-flex justify-content-center align-items-center" data-action="submit">
<span class="btn-text">{{ form.submit_value }}</span>
<span class="spinner-border spinner-border-sm" role="status"></span>
</button>
{% endif %}
</div>
</div>
Expand All @@ -63,9 +67,10 @@
$("form[action='{{form_action}}']").on("submit", function(e) {
if ("{{ form.submitting_value }}" !== "") {
$("button[data-action='submit']", this)
.removeClass("spinner-hidden")
.children().first().text("{{ form.submitting_value }}")
.attr("role", "status")
.attr("disabled", "true")
.text("{{ form.submitting_value }}")
.addClass("disabled");
}
});
Expand Down
17 changes: 17 additions & 0 deletions benefits/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ footer .footer-links li a:visited {
padding: var(--primary-button-padding);
}

.btn-text {
letter-spacing: 0.02em;
font-weight: var(--medium-font-weight);
font-size: calc(20rem / 16);
}

/* A button that actually is a text link */
/* TODO: Check if this is actually really used anymore */
.btn-link {
Expand All @@ -295,6 +301,17 @@ footer .footer-links li a:visited {
border-width: 2px;
}

/* Custom button: Loading spinner */

.spinner-hidden .spinner-border {
display: none;
}

.spinner-border {
border-width: 3px;
margin-left: 15px;
}

/* Custom button: Login.gov Button with text and SVG */
/* Used on Eligibility Start */

Expand Down