aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/landing/Section.tsx
blob: caec6b60a6f0683ce3c9d5d686fc502322904f8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * SPDX-FileCopyrightText: 2023 Kristóf Marussy
 *
 * SPDX-License-Identifier: MIT
 */

import useBrokenLinks from '@docusaurus/useBrokenLinks';
import type { ReactNode } from 'react';

import styles from './Section.module.css';

export default function Section({
  title,
  id,
  children,
}: {
  title: string;
  id: string;
  children?: ReactNode;
}) {
  // Make sure the section anchors are not reported as broken.
  // See https://docusaurus.io/blog/releases/3.1#broken-anchors-checker and
  // https://github.com/facebook/docusaurus/issues/9721#issuecomment-1882898840
  useBrokenLinks().collectAnchor(id);

  return (
    <section id={id} className={styles.section}>
      <h2 className={styles.section__title}>{title}</h2>
      {children}
    </section>
  );
}

Section.defaultProps = {
  children: undefined,
};