import * as React from 'react';
import {
Section,
SectionType,
ImportExampleSection,
} from '../../typings/story-section';
import Markdown from '../../Markdown';
import styles from './styles.scss';
import { AnchoredTitle } from '../../AnchoredTitle/AnchoredTitle';
export const SIBLINGS = ['pretitle', 'title', 'subtitle', 'description'];
const SECTIONS_WITHOUT_SIBLINGS = [
SectionType.Title,
SectionType.Header,
SectionType.Example,
];
const sectionPrepares = {
[SectionType.ImportExample]: (section: ImportExampleSection) => ({
...section,
title: section.title || 'Import',
}),
};
const prepareSection = (section: Section) => {
const preparedSection = (
sectionPrepares[section.type] || ((i: unknown) => i)
)(section);
const siblingsWithDiv = SIBLINGS.filter(
sibling => preparedSection[sibling],
).reduce(
(sections, key) => ({
...sections,
[key]: (