MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / cellRenderer

Function cellRenderer

src/components/common/ComponentList.jsx:485–630  ·  view source on GitHub ↗
({ columnIndex, rowIndex, key, style })

Source from the content-addressed store, hash-verified

483 const rowCount = Math.ceil(filtered.length / columnCount);
484
485 const cellRenderer = ({ columnIndex, rowIndex, key, style }) => {
486 const index = rowIndex * columnCount + columnIndex;
487 if (index >= filtered.length) {
488 return <div key={key} style={style} />;
489 }
490 const item = filtered[index];
491 const to = `/${slug(fromPascal(item.categoryKey))}/${slug(fromPascal(item.componentKey))}`;
492 const isSaved = savedSet.has(item.key) || isComponentSaved(item.key);
493 const isLastCol = columnIndex === columnCount - 1;
494
495 const cellStyle = {
496 ...style,
497 width: columnWidth,
498 paddingRight: isLastCol ? 0 : GAP_PX,
499 paddingBottom: GAP_PX
500 };
501 return (
502 <div key={key} style={cellStyle}>
503 <Box
504 key={item.key}
505 as={RouterLink}
506 to={to}
507 data-item-key={item.key}
508 display="block"
509 role="group"
510 bg={colors.bgElevated}
511 border="1px solid rgba(255,255,255,0.04)"
512 borderRadius={`${CARD_RADIUS}px`}
513 p="6px"
514 textDecoration="none"
515 overflow="hidden"
516 transition="border-color 0.2s ease"
517 _hover={{ textDecoration: 'none', borderColor: 'rgba(255,255,255,0.1)' }}
518 onMouseEnter={() => setHoveredKey(item.key)}
519 onMouseLeave={() => setHoveredKey(prev => (prev === item.key ? null : prev))}
520 >
521 <Box position="relative" borderRadius="0px" overflow="hidden">
522 <LazyCardMedia
523 key={item.videoUrl || item.key}
524 videoUrl={item.videoUrl}
525 playing={hoveredKey === item.key}
526 />
527
528 {item.isNew ? (
529 <Box
530 position="absolute"
531 top="8px"
532 left="8px"
533 zIndex={2}
534 px="8px"
535 py="3px"
536 borderRadius="6px"
537 fontSize="10px"
538 fontWeight={600}
539 lineHeight={1}
540 textTransform="uppercase"
541 fontFamily="'Geist Mono', monospace"
542 color="#d8aeff"

Callers

nothing calls this directly

Calls 5

isComponentSavedFunction · 0.90
removeSavedComponentFunction · 0.90
toggleSavedComponentFunction · 0.90
fromPascalFunction · 0.85
slugFunction · 0.70

Tested by

no test coverage detected