<!DOCTYPE html>
<html lang="en">
<head>
    <title>RenewCMS | Setup</title>
    {{.Head}}

    <style>
        .form-container {
            max-width: 24rem;
        }
    </style>
</head>
<body class="d-flex min-vh-100 vw-100 justify-content-center align-items-center text-dark">
<div class="container">
    <div class="d-flex flex-column gap-5 m-auto form-container">
        <div>
            <h1>RenewCMS</h1>
            <h2>E-mail verification</h2>
        </div>
        {{ if .PageError.IsError }}
        <p>{{.PageError.Message}}</p>
        {{ else }}
        <p>Your e-mail was successfully validated!</p>
        <form action="../home" method="get" class="d-flex">
            <button class="btn btn-primary w-100" type="submit">
                <span class="visually-hidden spinner-border spinner-border-sm"
                      role="status"></span>
                <span>Continue</span>
            </button>
        </form>
        {{ end }}
    </div>
</div>

<script>
    const button = document.querySelector("button")

    function setButtonLoading() {
        button.classList.add("disabled")
        button.querySelector("button > span + span").classList.add("visually-hidden")
        button.querySelector("button > span:first-child").classList.remove("visually-hidden")
    }

    window.addEventListener('submit', setButtonLoading)
    button.addEventListener('click', setButtonLoading)
</script>

</body>
</html>
