Files
school_compare/nextjs-app/components/school/Post16DestinationsSection.tsx
T

40 lines
1.5 KiB
TypeScript
Raw Normal View History

/**
* Post16DestinationsSection — where a school's Year 13 leavers went.
* Server component.
*
* A separate publication, a separate cohort and a separate question from
* After Year 11, so it is a separate section rather than a tab: a parent
* choosing a secondary and a student choosing a sixth form are not the same
* reader.
*
* Not rendered at all for a school without post-16 provision. A "no data"
* placeholder there would imply something is missing, when the truthful
* statement is that the question does not apply — which is why the old
* "Post-16 destination data coming soon" note is gone rather than reworded.
*/
import type { DestinationPhase } from '@/lib/types';
import { Section, sectionStyles } from './sectionShared';
import { DestinationsView } from './DestinationsView';
export function Post16DestinationsSection({
destinations,
}: { destinations: DestinationPhase }) {
const hasContent = Object.values(destinations.groups)
.some(group => (group?.categories?.length ?? 0) > 0);
if (!hasContent) return null;
const cohort = destinations.groups.all?.cohort ?? null;
const year = destinations.cohort_year;
return (
<Section id="post16-destinations">
<h2 className={sectionStyles.sectionTitle}>After the sixth form</h2>
<p className={sectionStyles.sectionSubtitle}>
Where {cohort ? `the ${cohort} students` : 'the students'} who finished
Year 13{year ? ` in ${year}` : ''} went next.
</p>
<DestinationsView destinations={destinations} phase="ks5" />
</Section>
);
}