This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
components.ejs
43 lines (39 loc) · 1.56 KB
/
components.ejs
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
38
39
40
41
42
43
<% if (Array.isArray(components)) { %>
<% components.forEach((component) => { %>
<% sourcePath = component.config.sourcePath !== undefined ? component.config.sourcePath : component.sourcePath %>
<section class="styleguide-block">
<header class="styleguide-block-header">
<h2 class="title" id="<%= component.config.name.replace(/\s+/g, '-').toLowerCase() %>"><%= component.config.name %></h2>
<nav class="styleguide-shy styleguide-comma-list">
<% component.config.tag.forEach((tag, i, tags) => { %>
<a class="link" href="<%= root %>tag/<%= tag %>/index.html">
<%= tag -%>
</a><% if (tags.length > 1 && i < (tags.length - 1) && i >= 0) { %>, <% } %>
<% }) %>
</nav>
<span class="styleguide-shy styleguide-sourcepath"><%= sourcePath %></span>
</header>
<div class="content">
<%- component.html %>
<% if (component.config.insert) { %>
<%-
include('./insert', {
config,
insert: component.config.insert,
sourcePath: component.sourcePath
})
%>
<% } %>
<% if (component.config.template) { %>
<%-
include(`./${component.config.template}`, {
component
})
%>
<% } %>
</div>
</section>
<% }) %>
<% } else { %>
<%- html %>
<% } %>