Add conditional admin menu to photo tiles
This commit is contained in:
parent
b6da801c8c
commit
5d85fbf862
@ -35,9 +35,9 @@ export default function MoreMenu({
|
|||||||
<button
|
<button
|
||||||
className={clsx(
|
className={clsx(
|
||||||
buttonClassName,
|
buttonClassName,
|
||||||
'p-1 py-1 min-h-0 border-none shadow-none outline-none',
|
'p-1 min-h-0 border-none shadow-none hover:outline-none',
|
||||||
'hover:bg-gray-50 active:bg-gray-100',
|
'hover:bg-gray-100 active:bg-gray-100',
|
||||||
'hover:dark:bg-gray-900/75 active:dark:bg-gray-900',
|
'hover:dark:bg-gray-800/75 active:dark:bg-gray-900',
|
||||||
'text-dim',
|
'text-dim',
|
||||||
)}
|
)}
|
||||||
aria-label={`Choose an action for photo: ${'photo'}`}
|
aria-label={`Choose an action for photo: ${'photo'}`}
|
||||||
@ -54,7 +54,7 @@ export default function MoreMenu({
|
|||||||
'min-w-[8rem]',
|
'min-w-[8rem]',
|
||||||
'ml-2.5',
|
'ml-2.5',
|
||||||
'p-1 rounded-md border',
|
'p-1 rounded-md border',
|
||||||
'bg-content outline-none',
|
'bg-content',
|
||||||
'shadow-lg dark:shadow-xl',
|
'shadow-lg dark:shadow-xl',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@ -65,7 +65,7 @@ export default function MoreMenu({
|
|||||||
className={clsx(
|
className={clsx(
|
||||||
'block w-full',
|
'block w-full',
|
||||||
'border-none min-h-0 bg-transparent',
|
'border-none min-h-0 bg-transparent',
|
||||||
'select-none outline-none',
|
'select-none hover:outline-none',
|
||||||
'text-sm text-main text-left',
|
'text-sm text-main text-left',
|
||||||
'px-3 py-1.5 rounded-[3px]',
|
'px-3 py-1.5 rounded-[3px]',
|
||||||
'hover:text-main',
|
'hover:text-main',
|
||||||
|
|||||||
@ -60,7 +60,7 @@ export default function PhotoGrid({
|
|||||||
'aspect-square',
|
'aspect-square',
|
||||||
'overflow-hidden',
|
'overflow-hidden',
|
||||||
'[&>*]:flex [&>*]:w-full [&>*]:h-full',
|
'[&>*]:flex [&>*]:w-full [&>*]:h-full',
|
||||||
'[&>*>*]:object-cover [&>*>*]:min-h-full',
|
'[&>*>*]:object-cover',
|
||||||
)
|
)
|
||||||
: undefined}
|
: undefined}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import { clsx } from 'clsx/lite';
|
|||||||
import { pathForPhoto } from '@/site/paths';
|
import { pathForPhoto } from '@/site/paths';
|
||||||
import { Camera } from '@/camera';
|
import { Camera } from '@/camera';
|
||||||
import { FilmSimulation } from '@/simulation';
|
import { FilmSimulation } from '@/simulation';
|
||||||
|
import AdminPhotoMenu from '@/admin/AdminPhotoMenu';
|
||||||
|
import { Suspense } from 'react';
|
||||||
|
|
||||||
export default function PhotoSmall({
|
export default function PhotoSmall({
|
||||||
photo,
|
photo,
|
||||||
@ -12,21 +14,34 @@ export default function PhotoSmall({
|
|||||||
camera,
|
camera,
|
||||||
simulation,
|
simulation,
|
||||||
selected,
|
selected,
|
||||||
|
showAdminMenu,
|
||||||
}: {
|
}: {
|
||||||
photo: Photo
|
photo: Photo
|
||||||
tag?: string
|
tag?: string
|
||||||
camera?: Camera
|
camera?: Camera
|
||||||
simulation?: FilmSimulation
|
simulation?: FilmSimulation
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
|
showAdminMenu?: boolean
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
href={pathForPhoto(photo, tag, camera, simulation)}
|
href={pathForPhoto(photo, tag, camera, simulation)}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
|
'relative group',
|
||||||
'active:brightness-75',
|
'active:brightness-75',
|
||||||
selected && 'brightness-50',
|
selected && 'brightness-50',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
<Suspense>
|
||||||
|
{showAdminMenu &&
|
||||||
|
<AdminPhotoMenu
|
||||||
|
buttonClassName={clsx(
|
||||||
|
'absolute top-1 right-1 opacity-0',
|
||||||
|
'group-hover:opacity-100 group-focus:opacity-100',
|
||||||
|
)}
|
||||||
|
photo={photo}
|
||||||
|
/>}
|
||||||
|
</Suspense>
|
||||||
<ImageSmall
|
<ImageSmall
|
||||||
src={photo.url}
|
src={photo.url}
|
||||||
aspectRatio={photo.aspectRatio}
|
aspectRatio={photo.aspectRatio}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user