From 28f5300bb6990a05b6952ed866389e81e6d315fe Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Thu, 3 Oct 2024 12:49:14 +0900 Subject: [PATCH] feat: add card_cover_position to collection card --- packages/react-notion-x/src/third-party/collection-card.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-notion-x/src/third-party/collection-card.tsx b/packages/react-notion-x/src/third-party/collection-card.tsx index 805744419..35f42346a 100644 --- a/packages/react-notion-x/src/third-party/collection-card.tsx +++ b/packages/react-notion-x/src/third-party/collection-card.tsx @@ -29,8 +29,9 @@ export const CollectionCard: React.FC = ({ } = ctx let coverContent = null - const { page_cover_position = 0.5 } = block.format || {} + const { page_cover_position = 0.5, card_cover_position = 0.5 } = block.format || {} const coverPosition = (1 - page_cover_position) * 100 + const cardCoverPosition = (1 - card_cover_position) * 100 if (cover?.type === 'page_content') { const contentBlockId = block.content?.find((blockId) => { @@ -57,7 +58,8 @@ export const CollectionCard: React.FC = ({ src={src} alt={caption || 'notion image'} style={{ - objectFit: coverAspect + objectFit: coverAspect, + objectPosition: `center ${cardCoverPosition}%` }} /> )