Files
payloadcms/test/app/live-preview/_components/CollectionArchive/index.tsx
2024-03-19 11:31:50 -04:00

26 lines
756 B
TypeScript

import React from 'react'
import type { ArchiveBlockProps } from '../../_blocks/ArchiveBlock/types.js'
import { CollectionArchiveByCollection } from './PopulateByCollection/index.js'
import { CollectionArchiveBySelection } from './PopulateBySelection/index.js'
export type Props = Omit<ArchiveBlockProps, 'blockType'> & {
className?: string
sort?: string
}
export const CollectionArchive: React.FC<Props> = (props) => {
const { className, populateBy, selectedDocs } = props
if (populateBy === 'selection') {
return <CollectionArchiveBySelection className={className} selectedDocs={selectedDocs} />
}
if (populateBy === 'collection') {
return <CollectionArchiveByCollection {...props} className={className} />
}
return null
}