From 54f7687e52fe17373d509492c4109731f26e5d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sun, 31 Mar 2024 18:03:19 -0700 Subject: [PATCH] censor works in work galleries when marked as Mature (#796) --- .../components/work_gallery/work_gallery.css | 18 ++++++++++++++---- .../components/work_gallery/work_gallery.ex | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/banchan_web/components/work_gallery/work_gallery.css b/lib/banchan_web/components/work_gallery/work_gallery.css index e601030c..1435583e 100644 --- a/lib/banchan_web/components/work_gallery/work_gallery.css +++ b/lib/banchan_web/components/work_gallery/work_gallery.css @@ -2,13 +2,23 @@ ul { @apply gap-0 sm:gap-1 columns-2 sm:columns-3 md:columns-4; & > li { - @apply my-0 sm:mb-1 relative sm:hover:scale-105 sm:hover:z-10 cursor-pointer transition-all w-full; + @apply my-0 sm:mb-1 relative sm:hover:scale-105 sm:hover:z-10 cursor-pointer transition-all w-full overflow-hidden; break-inside: avoid-column; - } - & img { - @apply m-auto object-scale-down; + & img { + @apply m-auto object-scale-down; + } + + &.mature { + & span { + @apply absolute top-2 left-2 flex flex-row items-center px-1 py-px text-xs font-bold bg-opacity-75 border rounded-md bg-error text-error-content border-base-100 border-opacity-10 cursor-pointer; + } + + & img { + @apply blur-lg; + } + } } & :deep(bc-icon) { diff --git a/lib/banchan_web/components/work_gallery/work_gallery.ex b/lib/banchan_web/components/work_gallery/work_gallery.ex index 3f1a0dad..9adcffab 100644 --- a/lib/banchan_web/components/work_gallery/work_gallery.ex +++ b/lib/banchan_web/components/work_gallery/work_gallery.ex @@ -26,13 +26,14 @@ defmodule BanchanWeb.Components.WorkGallery do {/if} {#for work <- @works} {#if Works.first_previewable_upload(work) || @show_non_media} -
  • +
  • {#if Works.first_previewable_upload(work)} {work.title} + M {#else}