feat: add spoiler warning

This commit is contained in:
Devin Haska 2025-02-01 22:50:46 -08:00
parent 307f1fdedf
commit 3a351af2a8
5 changed files with 33 additions and 2 deletions

View file

@ -10,6 +10,13 @@ layout: "layouts/base"
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
{% if pullquote %}<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p>{% endif %} {% if pullquote %}<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p>{% endif %}
</header> </header>
{% if hasSpoilers %}
<section class="bg-surface radius-0.5 p-1">
<span class="text-secondary">{% include "svgs/triangle-exclamation.svg" %}</span>
<strong>Warning!</strong>
The following may contain spoilers!
</section>
{% endif %}
{% if content %} {% if content %}
<section class="flow"> <section class="flow">
{{ content | safe }} {{ content | safe }}

View file

@ -8,8 +8,15 @@ layout: "layouts/base"
<header class="flow flow-space-1"> <header class="flow flow-space-1">
{{ format(page.date) }} {{ format(page.date) }}
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p> {% if pullquote %}<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p>{% endif %}
</header> </header>
{% if hasSpoilers %}
<section class="bg-surface radius-0.5 p-1">
<span class="text-secondary">{% include "svgs/triangle-exclamation.svg" %}</span>
<strong>Warning!</strong>
The following may contain spoilers!
</section>
{% endif %}
{% if content %} {% if content %}
<section class="flow"> <section class="flow">
{{ content | safe }} {{ content | safe }}

View file

@ -10,13 +10,20 @@ layout: "layouts/base"
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p> <p class="text-fadeText flow-space-0.25">{{ pullquote }}</p>
</header> </header>
{% if hasSpoilers %}
<section class="bg-surface radius-0.5 p-1">
<span class="text-secondary">{% include "svgs/triangle-exclamation.svg" %}</span>
<strong>Warning!</strong>
The following may contain spoilers!
</section>
{% endif %}
{% if watchHistory.length > 1 %} {% if watchHistory.length > 1 %}
<p> <p>
<span class="text-primary">{% include "svgs/circle-info.svg" %}</span> <span class="text-primary">{% include "svgs/circle-info.svg" %}</span>
I've seen this movie <strong>{{ watchHistory.length }}</strong> {{ "time" | pluralize(watchHistory) }}! I've seen this movie <strong>{{ watchHistory.length }}</strong> {{ "time" | pluralize(watchHistory) }}!
</p> </p>
{% endif %} {% endif %}
{% if favourite %} {% if favourite or isFavourite %}
<p> <p>
<span class="text-secondary">{% include "svgs/star.svg" %}</span> <span class="text-secondary">{% include "svgs/star.svg" %}</span>
This is one of my favourite movies! This is one of my favourite movies!

View file

@ -10,6 +10,13 @@ layout: "layouts/base"
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<p class="text-fadeText flow-space-0.25">{{ pullquote }}</p> <p class="text-fadeText flow-space-0.25">{{ pullquote }}</p>
</header> </header>
{% if hasSpoilers %}
<section class="bg-surface radius-0.5 p-1">
<span class="text-secondary">{% include "svgs/triangle-exclamation.svg" %}</span>
<strong>Warning!</strong>
The following may contain spoilers!
</section>
{% endif %}
{% if content %} {% if content %}
<section class="flow"> <section class="flow">
{{ content | safe }} {{ content | safe }}

View file

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 15H0V12L7 0H9L16 12V15ZM7 4H9V9H7V4ZM7 11H9V13H7V11Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 232 B