Merge branch 'DRVDOC-1260' into 'main'
[ProtonMail-WebClient.git] / packages / components / containers / overview / Sections.tsx
blob5528c92c2d53ce8f72fda044014474bc3b38fd48
1 import type { SubSectionConfig } from '../layout/interface';
2 import LinkItem from './LinkItem';
4 interface Props {
5     to: string;
6     text: string;
7     subsections?: SubSectionConfig[];
8     available?: boolean;
10 const Sections = ({ to, subsections = [], text, available }: Props) => {
11     return (
12         <ul className="unstyled mt-2">
13             {subsections.length ? (
14                 subsections
15                     .filter(({ hide }) => !hide)
16                     .map(({ text, id, available }) => {
17                         return (
18                             <li key={id} className="my-2">
19                                 <LinkItem to={`${to}#${id}`} text={text} available={available} />
20                             </li>
21                         );
22                     })
23             ) : (
24                 <li>
25                     <LinkItem to={to} text={text} available={available} />
26                 </li>
27             )}
28         </ul>
29     );
32 export default Sections;