Adds the fallbacks for visitors without JavaScript
The mobile menu works through CSS, and controls that need JavaScript are hidden without it. The contact photo gets its own preload, and the tests cover the new Reveal behaviour, the first row and the noscript markup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,13 +9,20 @@ import {
|
||||
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
import type { GalleryItem } from '@/content/types';
|
||||
import { firstRow } from '@/lib/firstRow';
|
||||
import { firstRow, GRID_COLUMNS } from '@/lib/firstRow';
|
||||
import {
|
||||
GAP_ROWS,
|
||||
masonryRowSpan,
|
||||
ROWS_PER_COLUMN_WIDTH,
|
||||
} from '@/lib/masonryRowSpan';
|
||||
|
||||
const [BASE_COLUMNS, MD_COLUMNS, LG_COLUMNS] = GRID_COLUMNS.map(
|
||||
(entry) => entry.columns,
|
||||
);
|
||||
|
||||
const columnTemplate = (columns: number) =>
|
||||
columns === 1 ? '1fr' : `repeat(${columns}, 1fr)`;
|
||||
|
||||
type PortfolioGridProps = {
|
||||
items: readonly GalleryItem[];
|
||||
// The photos of the first row (one column per screen width, see firstRow)
|
||||
@@ -109,17 +116,17 @@ export default function PortfolioGrid({
|
||||
listStyleType="none"
|
||||
display="grid"
|
||||
gridTemplateColumns={{
|
||||
base: '1fr',
|
||||
md: 'repeat(2, 1fr)',
|
||||
lg: 'repeat(3, 1fr)',
|
||||
base: columnTemplate(BASE_COLUMNS),
|
||||
md: columnTemplate(MD_COLUMNS),
|
||||
lg: columnTemplate(LG_COLUMNS),
|
||||
}}
|
||||
columnGap="gridGap"
|
||||
// One implicit row = column width / ROWS_PER_COLUMN_WIDTH
|
||||
gridAutoRows="var(--row)"
|
||||
css={{
|
||||
'--cols': '1',
|
||||
md: { '--cols': '2' },
|
||||
lg: { '--cols': '3' },
|
||||
'--cols': String(BASE_COLUMNS),
|
||||
md: { '--cols': String(MD_COLUMNS) },
|
||||
lg: { '--cols': String(LG_COLUMNS) },
|
||||
'--row': `calc((100cqi - (var(--cols) - 1) * {spacing.gridGap}) / var(--cols) / ${ROWS_PER_COLUMN_WIDTH})`,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user