19 lines
683 B
TypeScript
19 lines
683 B
TypeScript
import type { PageSection } from '@homaroma/types'
|
|
|
|
const announcementTypes = new Set(['ANNOUNCEMENT_BAR'])
|
|
const heroTypes = new Set(['HERO', 'BANNER'])
|
|
|
|
function sectionType(section: PageSection) {
|
|
return section.type.toUpperCase()
|
|
}
|
|
|
|
export function splitCmsLayoutSections(sections: PageSection[]) {
|
|
const activeSections = sections.filter((section) => section.isActive)
|
|
|
|
return {
|
|
announcementSections: activeSections.filter((section) => announcementTypes.has(sectionType(section))),
|
|
heroSections: [], // Keep for backwards compatibility with page components
|
|
bottomSections: activeSections.filter((section) => !announcementTypes.has(sectionType(section))),
|
|
}
|
|
}
|