import * as React from 'react'; import { StoryConfig } from '../typings/story-config'; import { tab } from './views/tab'; import { tab as makeTab } from '.'; import { SectionType } from '../typings/story-section'; import styles from './styles.scss'; const Header = ({ storyName, metadata }) => (
{storyName}
{metadata.displayName && (
{`<${metadata.displayName}/>`}
)}
); const hasHeader = (sections = []) => sections[0] && sections[0].type === SectionType.Header; export const View: React.FunctionComponent = storyConfig => { return (
{!hasHeader(storyConfig.sections) && (
)} {tab( makeTab({ sections: storyConfig.sections, }), storyConfig, )}
); };