export function mapSection()

in packages/showcase/showcase-components/showcase-utils.js [5:37]


export function mapSection(section) {
  const {docsLink, comment, name, componentName} = section;
  const SectionComponent = section.component;
  const linkProps = {
    className: 'docs-link',
    target: '_blank',
    rel: 'noopener noreferrer'
  };
  const exampleLink = SHOWCASE_LINKS[componentName];
  return (
    <section key={`${name}-index`}>
      <div className="section-header">
        <h3 className="section-title">{name}</h3>
        <div className="flex">
          {exampleLink && (
            <a {...linkProps} href={exampleLink}>
              {' '}
              View Code
            </a>
          )}
          {docsLink && (
            <a {...linkProps} href={docsLink}>
              {' '}
              Documentation{' '}
            </a>
          )}
        </div>
      </div>
      {comment && <p className="docs-comment">{comment}</p>}
      <SectionComponent />
    </section>
  );
}