-
Notifications
You must be signed in to change notification settings - Fork 832
Expand file tree
/
Copy pathshowcase-utils.js
More file actions
37 lines (35 loc) · 1006 Bytes
/
Copy pathshowcase-utils.js
File metadata and controls
37 lines (35 loc) · 1006 Bytes
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
37
import React from 'react';
import {SHOWCASE_LINKS} from '../showcase-links';
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">
{name && <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>
);
}