- move reply controls into normal left-aligned flow - restore stronger primary/reply button treatments - render Turnstile when reply details panels are opened - rebuild Tailwind CSS
99 lines
4.6 KiB
HTML
99 lines
4.6 KiB
HTML
{% load static %}
|
|
<div id="comment-form-container" class="rounded-lg border border-zinc-200 bg-brand-surfaceLight p-6 shadow-sm dark:border-zinc-800 dark:bg-brand-surfaceDark sm:p-8">
|
|
<div class="max-w-3xl">
|
|
<h3 class="font-display text-2xl font-bold text-zinc-900 dark:text-zinc-100">Leave a comment</h3>
|
|
<p class="mt-1 font-mono text-xs uppercase tracking-wider text-zinc-500">
|
|
Keep it constructive. Your email will not be shown publicly.
|
|
</p>
|
|
|
|
{% if success_message %}
|
|
<div class="mt-5 rounded-md border border-brand-cyan/30 bg-brand-cyan/10 p-3 font-mono text-sm text-brand-cyan">
|
|
{{ success_message }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if comment_form.errors %}
|
|
<div aria-label="Comment form errors" class="mt-5 rounded-md border border-red-500/30 bg-red-500/10 p-4 font-mono text-sm text-red-500">
|
|
<div class="mb-2 text-xs font-bold uppercase tracking-wider">There were some errors:</div>
|
|
<ul class="list-disc list-inside space-y-1">
|
|
{% if comment_form.non_field_errors %}
|
|
{% for error in comment_form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
|
|
{% endif %}
|
|
{% for field in comment_form %}
|
|
{% if field.errors %}
|
|
{% for error in field.errors %}<li>{{ field.label }}: {{ error }}</li>{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<form
|
|
method="post"
|
|
action="{% url 'comment_post' %}"
|
|
data-comment-form
|
|
class="mt-6 space-y-5"
|
|
hx-post="{% url 'comment_post' %}"
|
|
hx-target="#comment-form-container"
|
|
hx-swap="outerHTML"
|
|
>
|
|
{% csrf_token %}
|
|
<input type="hidden" name="article_id" value="{{ page.id }}" />
|
|
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
<div>
|
|
<label for="comment-author-name" class="mb-1 block font-mono text-xs font-semibold uppercase tracking-wider text-zinc-500">Name</label>
|
|
<input
|
|
id="comment-author-name"
|
|
type="text"
|
|
name="author_name"
|
|
value="{% if comment_form %}{{ comment_form.author_name.value|default:'' }}{% endif %}"
|
|
required
|
|
class="w-full rounded-md border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-brand-cyan focus:outline-none focus:ring-2 focus:ring-brand-cyan/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label for="comment-author-email" class="mb-1 block font-mono text-xs font-semibold uppercase tracking-wider text-zinc-500">Email</label>
|
|
<input
|
|
id="comment-author-email"
|
|
type="email"
|
|
name="author_email"
|
|
value="{% if comment_form %}{{ comment_form.author_email.value|default:'' }}{% endif %}"
|
|
required
|
|
class="w-full rounded-md border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-brand-cyan focus:outline-none focus:ring-2 focus:ring-brand-cyan/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="comment-body" class="mb-1 block font-mono text-xs font-semibold uppercase tracking-wider text-zinc-500">Comment</label>
|
|
<textarea
|
|
id="comment-body"
|
|
name="body"
|
|
required
|
|
rows="5"
|
|
class="w-full rounded-md border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-brand-cyan focus:outline-none focus:ring-2 focus:ring-brand-cyan/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100"
|
|
>{% if comment_form %}{{ comment_form.body.value|default:'' }}{% endif %}</textarea>
|
|
</div>
|
|
|
|
<input type="text" name="honeypot" hidden />
|
|
|
|
{% if turnstile_site_key %}
|
|
<div class="cf-turnstile" data-sitekey="{{ turnstile_site_key }}" data-theme="auto"></div>
|
|
{% endif %}
|
|
|
|
<div class="pt-1">
|
|
<button
|
|
type="submit"
|
|
class="group relative inline-flex items-center gap-3 rounded-md bg-brand-pink px-7 py-3 font-display text-sm font-bold uppercase tracking-widest text-white transition-all hover:-translate-y-0.5 hover:bg-brand-pink/90 focus:outline-none focus:ring-2 focus:ring-brand-pink/40 active:translate-y-0"
|
|
>
|
|
<span>Post comment</span>
|
|
<svg class="h-4 w-4 transition-transform group-hover:translate-x-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|