Skip to content

Commit dd9b3df

Browse files
committed
Theme improvements for monorepos
1 parent e715b36 commit dd9b3df

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

src/default_theme/assets/site.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,20 @@ split_left.style.overflow = 'hidden';
113113
var cw_without_sb = split_left.clientWidth;
114114
split_left.style.overflow = '';
115115

116-
Split(['#split-left', '#split-right'], {
117-
elementStyle: function(dimension, size, gutterSize) {
118-
return {
119-
'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)'
120-
};
121-
},
122-
gutterStyle: function(dimension, gutterSize) {
123-
return {
124-
'flex-basis': gutterSize + 'px'
125-
};
126-
},
127-
gutterSize: 20,
128-
sizes: [33, 67]
129-
});
116+
// Split(['#split-left', '#split-right'], {
117+
// elementStyle: function(dimension, size, gutterSize) {
118+
// return {
119+
// 'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)'
120+
// };
121+
// },
122+
// gutterStyle: function(dimension, gutterSize) {
123+
// return {
124+
// 'flex-basis': gutterSize + 'px'
125+
// };
126+
// },
127+
// gutterSize: 20,
128+
// sizes: [33, 67]
129+
// });
130130

131131
// Chrome doesn't remember scroll position properly so do it ourselves.
132132
// Also works on Firefox and Edge.

src/default_theme/index._

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
88
<link href='assets/style.css' type='text/css' rel='stylesheet' />
99
<link href='assets/github.css' type='text/css' rel='stylesheet' />
10-
<link href='assets/split.css' type='text/css' rel='stylesheet' />
1110
</head>
1211
<body class='documentation m0'>
1312
<div class='flex'>
@@ -24,10 +23,11 @@
2423
<ul class='list-reset h5 py1-ul'>
2524
<% docs.forEach(function(doc) { %>
2625
<% var hasMembers = doc.members.static.length || doc.members.instance.length %>
26+
<% var displayName = getDisplayName(doc) %>
2727
<li><a
2828
href='#<%=slug(doc.namespace)%>'
29-
class="<% if (doc.kind === 'note') { %>h5 bold black caps<% } %><% if (hasMembers) { %> toggle-sibling<% } %>">
30-
<%- doc.name %>
29+
class="<% if (doc.kind === 'note') { %>h5 bold black<% } %><% if (hasMembers) { %> toggle-sibling<% } %>">
30+
<%- displayName %>
3131
<% if (hasMembers) { %><span class='icon'>▸</span><% } %>
3232
</a>
3333
<% if (hasMembers) { %>
@@ -86,9 +86,6 @@
8686
<% }) %>
8787
</ul>
8888
</div>
89-
<div class='mt1 h6 quiet'>
90-
<a href='http://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
91-
</div>
9289
</div>
9390
</div>
9491
<div id='split-right' class='relative overflow-auto height-viewport-100'>
@@ -101,13 +98,13 @@
10198
renderParamProperty: renderParamProperty
10299
}) %>
103100
<% } else { %>
101+
<hr />
104102
<div class='keyline-top-not py2'><%=renderNote({ note: s })%></div>
105103
<% } %>
106104
<% }) %>
107105
</div>
108106
</div>
109107
<script src='assets/anchor.js'></script>
110-
<script src='assets/split.js'></script>
111108
<script src='assets/site.js'></script>
112109
</body>
113110
</html>

src/default_theme/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ module.exports = function(
3636

3737
var sharedImports = {
3838
imports: {
39+
getDisplayName(doc) {
40+
return doc.tags ? doc.tags.reduce(
41+
(acc, tag) => {
42+
if (tag.title === 'exportName') {
43+
return tag.description;
44+
}
45+
return acc;
46+
}, doc.name) : doc.name;
47+
},
3948
slug(str) {
4049
var slugger = new GithubSlugger();
4150
return slugger.slug(str);

src/default_theme/note._

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<section class='py2 clearfix'>
2-
3-
<h2 id='<%- slug(note.namespace) %>' class='mt0'>
4-
<%- note.name %>
5-
</h2>
6-
1+
<section id='<%- slug(note.namespace) %>' class='py2 clearfix'>
72
<% if (note.description) { %>
83
<%= md(note.description) %>
94
<% } %>

src/default_theme/section._

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class='clearfix'>
55
<% if (typeof nested === 'undefined') { %>
66
<h3 class='fl m0' id='<%- slug(section.namespace) %>'>
7-
<%- section.name %>
7+
<%- getDisplayName(section) %>
88
</h3>
99
<% } %>
1010
<% if (section.context && section.context.github) { %>
@@ -115,6 +115,14 @@
115115
<% }) %>
116116
<% } %>
117117

118+
<% if ((section.members.instance && section.members.instance.length) && section.examples.length) { %>
119+
<div class='py1 quiet mt1 prose-big'>Example</div>
120+
<% section.examples.forEach(function(example) { %>
121+
<% if (example.caption) { %><p><%= md(example.caption) %></p><% } %>
122+
<pre class='p1 overflow-auto round fill-light'><%= highlight(example.description) %></pre>
123+
<% }) %>
124+
<% } %>
125+
118126
<% if (section.throws.length) { %>
119127
<div class='py1 quiet mt1 prose-big'>Throws</div>
120128
<ul>
@@ -124,14 +132,6 @@
124132
</ul>
125133
<% } %>
126134

127-
<% if (section.examples.length) { %>
128-
<div class='py1 quiet mt1 prose-big'>Example</div>
129-
<% section.examples.forEach(function(example) { %>
130-
<% if (example.caption) { %><p><%= md(example.caption) %></p><% } %>
131-
<pre class='p1 overflow-auto round fill-light'><%= highlight(example.description) %></pre>
132-
<% }) %>
133-
<% } %>
134-
135135
<% if (section.members.static && section.members.static.length) { %>
136136
<div class='py1 quiet mt1 prose-big'>Static Members</div>
137137
<%= renderSectionList({ members: section.members.static, renderSection: renderSection, renderParamProperty: renderParamProperty, noun: 'Static Member' }) %>
@@ -146,4 +146,12 @@
146146
<div class='py1 quiet mt1 prose-big'>Events</div>
147147
<%= renderSectionList({ members: section.members.events, renderSection: renderSection, renderParamProperty: renderParamProperty, noun: 'Event' }) %>
148148
<% } %>
149+
150+
<% if ((!section.members.instance || !section.members.instance.length) && section.examples.length) { %>
151+
<div class='py1 quiet mt1 prose-big'>Example</div>
152+
<% section.examples.forEach(function(example) { %>
153+
<% if (example.caption) { %><p><%= md(example.caption) %></p><% } %>
154+
<pre class='p1 overflow-auto round fill-light'><%= highlight(example.description) %></pre>
155+
<% }) %>
156+
<% } %>
149157
</section>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy