Skip to content

Commit c862db0

Browse files
Merge pull request NotionX#563 from papermark/feat/collection-card
feat: add `card_cover_position` to collection card
2 parents e1f03de + 28f5300 commit c862db0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/react-notion-x/src/third-party/collection-card.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ export const CollectionCard: React.FC<CollectionCardProps> = ({
2929
} = ctx
3030
let coverContent = null
3131

32-
const { page_cover_position = 0.5 } = block.format || {}
32+
const { page_cover_position = 0.5, card_cover_position = 0.5 } = block.format || {}
3333
const coverPosition = (1 - page_cover_position) * 100
34+
const cardCoverPosition = (1 - card_cover_position) * 100
3435

3536
if (cover?.type === 'page_content') {
3637
const contentBlockId = block.content?.find((blockId) => {
@@ -57,7 +58,8 @@ export const CollectionCard: React.FC<CollectionCardProps> = ({
5758
src={src}
5859
alt={caption || 'notion image'}
5960
style={{
60-
objectFit: coverAspect
61+
objectFit: coverAspect,
62+
objectPosition: `center ${cardCoverPosition}%`
6163
}}
6264
/>
6365
)

0 commit comments

Comments
 (0)