Refine entity links, photo set headers

This commit is contained in:
Sam Becker 2023-12-16 19:44:26 -06:00
parent ef45c8cbbd
commit ac3c8be7b0
6 changed files with 25 additions and 16 deletions

View File

@ -32,13 +32,13 @@ export default function PhotoCamera({
title="Apple" title="Apple"
className={cc( className={cc(
'text-icon', 'text-icon',
'translate-x-[-2.5px] translate-y-[-2px]', 'translate-x-[-2.5px] translate-y-[-1.5px]',
)} )}
size={14} size={14}
/> />
: <IoMdCamera : <IoMdCamera
size={13} size={13}
className="text-icon translate-y-[-0.25px]" className="text-icon translate-x-[-1px] translate-y-[-0.5px]"
/>} />}
type={showAppleIcon && isCameraApple ? 'icon-first' : type} type={showAppleIcon && isCameraApple ? 'icon-first' : type}
badged={badged} badged={badged}

View File

@ -27,7 +27,7 @@ export default function EntityLink({
title?: string title?: string
hoverEntity?: ReactNode hoverEntity?: ReactNode
} & EntityLinkExternalProps) { } & EntityLinkExternalProps) {
const renderContent = () => <> const renderLabel = () => <>
<span className="xs:hidden"> <span className="xs:hidden">
{labelSmall ?? label} {labelSmall ?? label}
</span> </span>
@ -42,7 +42,7 @@ export default function EntityLink({
href={href} href={href}
title={title} title={title}
className={cc( className={cc(
'inline-flex gap-1', 'inline-flex gap-[0.2rem]',
!badged && 'text-main hover:text-gray-900 dark:hover:text-gray-100', !badged && 'text-main hover:text-gray-900 dark:hover:text-gray-100',
dim && 'text-dim', dim && 'text-dim',
)} )}
@ -51,16 +51,16 @@ export default function EntityLink({
{badged {badged
? <span className="h-6 inline-flex items-center"> ? <span className="h-6 inline-flex items-center">
<Badge type="secondary" uppercase interactive> <Badge type="secondary" uppercase interactive>
{renderContent()} {renderLabel()}
</Badge> </Badge>
</span> </span>
: <span className="uppercase"> : <span className="uppercase">
{renderContent()} {renderLabel()}
</span>} </span>}
</>} </>}
{icon && type !== 'text-only' && {icon && type !== 'text-only' &&
<span className={cc( <span className={cc(
'text-dim inline-flex min-w-[1rem]', 'text-dim inline-flex min-w-[0.8rem]',
'translate-y-[4px]', 'translate-y-[4px]',
type === 'icon-first' && 'order-first', type === 'icon-first' && 'order-first',
)}> )}>

View File

@ -5,9 +5,7 @@ import AnimateItems from '@/components/AnimateItems';
import { Camera } from '@/camera'; import { Camera } from '@/camera';
import MorePhotos from '@/photo/MorePhotos'; import MorePhotos from '@/photo/MorePhotos';
import { FilmSimulation } from '@/simulation'; import { FilmSimulation } from '@/simulation';
import { GRID_ASPECT_RATIO } from '@/site/config'; import { GRID_ASPECT_RATIO, HIGH_DENSITY_GRID } from '@/site/config';
const HIGH_DENSITY = GRID_ASPECT_RATIO <= 1;
export default function PhotoGrid({ export default function PhotoGrid({
photos, photos,
@ -43,7 +41,7 @@ export default function PhotoGrid({
'grid gap-0.5 sm:gap-1', 'grid gap-0.5 sm:gap-1',
small small
? 'grid-cols-3 xs:grid-cols-6' ? 'grid-cols-3 xs:grid-cols-6'
: HIGH_DENSITY : HIGH_DENSITY_GRID
? 'grid-cols-2 xs:grid-cols-4 lg:grid-cols-5' ? 'grid-cols-2 xs:grid-cols-4 lg:grid-cols-5'
: 'grid-cols-2 sm:grid-cols-4 md:grid-cols-3 lg:grid-cols-4', : 'grid-cols-2 sm:grid-cols-4 md:grid-cols-3 lg:grid-cols-4',
'items-center', 'items-center',

View File

@ -3,6 +3,7 @@ import { Photo, PhotoDateRange, dateRangeForPhotos } from '.';
import ShareButton from '@/components/ShareButton'; import ShareButton from '@/components/ShareButton';
import AnimateItems from '@/components/AnimateItems'; import AnimateItems from '@/components/AnimateItems';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
import { HIGH_DENSITY_GRID } from '@/site/config';
export default function PhotoSetHeader({ export default function PhotoSetHeader({
entity, entity,
@ -37,14 +38,22 @@ export default function PhotoSetHeader({
items={[<div items={[<div
key="PhotosHeader" key="PhotosHeader"
className={cc( className={cc(
'flex flex-col gap-y-0.5 items-start', 'grid gap-0.5 sm:gap-1',
'xs:grid grid-cols-2 sm:grid-cols-4 md:grid-cols-3 lg:grid-cols-4', HIGH_DENSITY_GRID
? 'xs:grid-cols-2 sm:grid-cols-4 lg:grid-cols-5'
: 'xs:grid-cols-2 sm:grid-cols-4 md:grid-cols-3 lg:grid-cols-4',
)}> )}>
{entity} <span className={HIGH_DENSITY_GRID
? 'sm:col-span-2'
: undefined}>
{entity}
</span>
<span className={cc( <span className={cc(
'inline-flex gap-2 items-center self-start', 'inline-flex gap-2 items-center self-start',
'uppercase text-dim', 'uppercase text-dim',
'sm:col-span-2 md:col-span-1 lg:col-span-2', HIGH_DENSITY_GRID
? 'lg:col-span-2'
: 'sm:col-span-2 md:col-span-1 lg:col-span-2',
)}> )}>
{selectedPhotoIndex !== undefined {selectedPhotoIndex !== undefined
// eslint-disable-next-line max-len // eslint-disable-next-line max-len

View File

@ -59,6 +59,8 @@ export const GRID_ASPECT_RATIO = process.env.NEXT_PUBLIC_GRID_ASPECT_RATIO
export const OG_TEXT_BOTTOM_ALIGNMENT = export const OG_TEXT_BOTTOM_ALIGNMENT =
(process.env.NEXT_PUBLIC_OG_TEXT_ALIGNMENT ?? '').toUpperCase() === 'BOTTOM'; (process.env.NEXT_PUBLIC_OG_TEXT_ALIGNMENT ?? '').toUpperCase() === 'BOTTOM';
export const HIGH_DENSITY_GRID = GRID_ASPECT_RATIO <= 1;
export const CONFIG_CHECKLIST_STATUS = { export const CONFIG_CHECKLIST_STATUS = {
hasPostgres: (process.env.POSTGRES_HOST ?? '').length > 0, hasPostgres: (process.env.POSTGRES_HOST ?? '').length > 0,
hasBlob: HAS_VERCEL_BLOB || HAS_AWS_S3_STORAGE, hasBlob: HAS_VERCEL_BLOB || HAS_AWS_S3_STORAGE,

View File

@ -22,7 +22,7 @@ export default function PhotoTag({
size={11} size={11}
className={cc( className={cc(
'flex-shrink-0', 'flex-shrink-0',
'text-icon translate-y-[0.5px]', 'text-icon translate-y-[1px]',
)} )}
/>} />}
type={type} type={type}