<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
  <h1 class="title text-primary-600 text-xl">
    {dgettext("actions", "Register")}
  </h1>

  <.form
    :let={f}
    for={@changeset}
    action={~p"/users/register"}
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
  >
    <p :if={@changeset.action && not @changeset.valid?} class="alert alert-danger col-span-3">
      {dgettext("errors", "Oops, something went wrong! Please check the errors below.")}
    </p>

    <%= if @invite_token do %>
      {hidden_input(f, :invite_token, value: @invite_token)}
    <% end %>

    {label(f, :email, gettext("Email"), class: "title text-lg text-primary-600")}
    {email_input(f, :email, required: true, class: "input input-primary col-span-2")}
    {error_tag(f, :email, "col-span-3")}

    {label(f, :password, gettext("Password"), class: "title text-lg text-primary-600")}
    {password_input(f, :password, required: true, class: "input input-primary col-span-2")}
    {error_tag(f, :password, "col-span-3")}

    {label(f, :locale, gettext("Language"), class: "title text-lg text-primary-600")}
    {select(
      f,
      :locale,
      [
        {"English", "en_US"},
        {"Deutsch", "de"},
        {"Français", "fr"},
        {"Español", "es"}
      ],
      class: "input input-primary col-span-2"
    )}
    {error_tag(f, :locale)}

    {submit(dgettext("actions", "Register"), class: "mx-auto btn btn-primary col-span-3")}
  </.form>

  <hr class="hr" />

  <div class="flex flex-row justify-center items-center space-x-4">
    <.link href={~p"/users/log_in"} class="btn btn-primary">
      {dgettext("actions", "Log in")}
    </.link>
    <.link href={~p"/users/reset_password"} class="btn btn-primary">
      {dgettext("actions", "Forgot your password?")}
    </.link>
  </div>
</div>