Skip to content

Commit 556cb08

Browse files
Update MemoryHoneycomb.tsx
1 parent c904812 commit 556cb08

1 file changed

Lines changed: 0 additions & 151 deletions

File tree

‎src/MemoryHoneycomb.tsx‎

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -243,154 +243,3 @@ export default function MemoryHoneycomb({
243243
item => item.index === hoveredIndex
244244
);
245245

246-
// Draw the active image last so it appears above its neighbours.
247-
const renderItems =
248-
hoveredIndex === null
249-
? items
250-
: [
251-
...items.filter(item => item.index !== hoveredIndex),
252-
...items.filter(item => item.index === hoveredIndex),
253-
];
254-
255-
return (
256-
<div className="memory-svg-container">
257-
<svg
258-
className="memory-svg-wall"
259-
viewBox={`0 0 ${WIDTH} ${height}`}
260-
role="group"
261-
aria-label="Priyanshi's memory gallery"
262-
xmlns="http://www.w3.org/2000/svg"
263-
>
264-
<defs>
265-
<linearGradient
266-
id="memory-caption-gradient"
267-
x1="0"
268-
y1="0"
269-
x2="0"
270-
y2="1"
271-
>
272-
<stop offset="0%" stopColor="#241713" stopOpacity="0" />
273-
<stop offset="100%" stopColor="#241713" stopOpacity=".88" />
274-
</linearGradient>
275-
276-
{items.map(item => (
277-
<clipPath
278-
id={`clip-${item.memory.id}`}
279-
key={`clip-${item.memory.id}`}
280-
>
281-
<polygon points={hexPoints(item.radius)} />
282-
</clipPath>
283-
))}
284-
</defs>
285-
286-
<g className="memory-svg-grid">
287-
{renderItems.map(item => {
288-
const {
289-
memory,
290-
radius,
291-
x,
292-
y,
293-
index,
294-
} = item;
295-
296-
const isHovered = hoveredIndex === index;
297-
298-
const isNearby =
299-
hoveredItem !== undefined &&
300-
!isHovered &&
301-
Math.hypot(
302-
hoveredItem.x - x,
303-
hoveredItem.y - y
304-
) < STEP_X * 1.85;
305-
306-
const lines = captionLines(memory.caption);
307-
308-
return (
309-
<g
310-
key={memory.id}
311-
className="memory-svg-tile"
312-
transform={`translate(${x - radius}, ${y - radius})`}
313-
style={{
314-
animationDelay: `${Math.min(index, 35) * 15}ms`,
315-
}}
316-
onPointerEnter={event => {
317-
if (event.pointerType !== 'touch') {
318-
setHoveredIndex(index);
319-
}
320-
}}
321-
onPointerLeave={() => setHoveredIndex(null)}
322-
onClick={() => onSelect(index)}
323-
onKeyDown={event => {
324-
if (event.key === 'Enter' || event.key === ' ') {
325-
event.preventDefault();
326-
onSelect(index);
327-
}
328-
}}
329-
role="button"
330-
tabIndex={0}
331-
aria-label={memory.caption}
332-
>
333-
<title>{memory.caption}</title>
334-
335-
<g
336-
className={`memory-svg-tile-inner ${
337-
isHovered ? 'is-active' : ''
338-
} ${isNearby ? 'is-nearby' : ''}`}
339-
>
340-
<polygon
341-
points={hexPoints(radius)}
342-
className="memory-svg-border"
343-
/>
344-
345-
<image
346-
href={memory.src}
347-
x="0"
348-
y="0"
349-
width={radius * 2}
350-
height={radius * 2}
351-
preserveAspectRatio="xMidYMid slice"
352-
clipPath={`url(#clip-${memory.id})`}
353-
/>
354-
355-
<g
356-
className="memory-svg-caption"
357-
clipPath={`url(#clip-${memory.id})`}
358-
>
359-
<rect
360-
x="0"
361-
y={radius * 0.55}
362-
width={radius * 2}
363-
height={radius}
364-
fill="url(#memory-caption-gradient)"
365-
/>
366-
367-
{lines.map((line, lineIndex) => (
368-
<text
369-
key={lineIndex}
370-
x={radius}
371-
y={
372-
radius * 1.42 +
373-
lineIndex *
374-
(memory.featured ? 16 : 13)
375-
}
376-
textAnchor="middle"
377-
className="memory-svg-caption-text"
378-
>
379-
{line}
380-
</text>
381-
))}
382-
</g>
383-
384-
<polygon
385-
points={hexPoints(radius)}
386-
className="memory-svg-outline"
387-
/>
388-
</g>
389-
</g>
390-
);
391-
})}
392-
</g>
393-
</svg>
394-
</div>
395-
);
396-
}

0 commit comments

Comments
 (0)