Skip to content

Commit 15c4c77

Browse files
authored
Merge pull request #140 from docsbydoxdox/hotfix/bootstrap-styles
[hotfix] Bootstrap styles
2 parents 86a9f77 + 1d781c5 commit 15c4c77

File tree

2 files changed

+48
-20
lines changed

2 files changed

+48
-20
lines changed

packages/doxdox-renderer-bootstrap/src/__snapshots__/index.test.ts.snap

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,33 @@ exports[`bootstrap render 1`] = `
2525
font-size: 3.5rem;
2626
}
2727
28+
.pkg-name a {
29+
text-decoration: none;
30+
}
31+
2832
.pkg-description {
2933
font-size: 1.5rem;
3034
font-weight: 200;
3135
}
3236
33-
.method-name {
37+
nav .file-name {
38+
color: #E54D89;
39+
}
40+
41+
nav .method-name {
42+
margin: 0.25rem 0;
43+
}
44+
45+
main .method-name {
3446
position: relative;
3547
}
3648
37-
.method-scope {
49+
main .method-scope {
3850
font-size: 1.5rem;
3951
color: #999;
4052
}
4153
42-
.method-permalink {
54+
main .method-permalink {
4355
position: absolute;
4456
margin-left: -1em;
4557
font-weight: normal;
@@ -59,15 +71,16 @@ exports[`bootstrap render 1`] = `
5971
6072
<div class=\\"container\\">
6173
<div class=\\"row\\">
62-
<div class=\\"p-5 col-md-3\\">
63-
<p><b>directory/index.js</b></p>
74+
<nav class=\\"p-5 col-md-3\\">
75+
<p><a href=\\"#directory/index.js\\" class=\\"file-name\\"><b>directory/index.js</b></a></p>
6476
<ul class=\\"list-unstyled ml-0\\">
65-
<li><a href=\\"#index-js-methodname\\" class=\\"\\">methodName</a></li>
77+
<li class=\\"method-name\\"><a href=\\"#index-js-methodname\\" class=\\"\\">methodName</a></li>
6678
</ul>
67-
</div>
79+
</nav>
6880
69-
<div class=\\"p-5 col-md-9\\">
70-
<div class=\\"mb-5\\"><a name=\\"index-js-methodname\\" />
81+
<main class=\\"p-5 col-md-9\\">
82+
<a name=\\"directory/index.js\\" />
83+
<div class=\\"mb-5\\"><a name=\\"index-js-methodname\\" />
7184
7285
<h2 class=\\"method-name\\">
7386
<a href=\\"#index-js-methodname\\" class=\\"method-permalink\\" aria-label=\\"Permalink\\">#</a>
@@ -108,7 +121,7 @@ exports[`bootstrap render 1`] = `
108121
109122
</div>
110123
111-
</div>
124+
</main>
112125
</div>
113126
</div>
114127

packages/doxdox-renderer-bootstrap/src/index.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,23 @@ ${method.returns.map(
6565
</div>
6666
`;
6767

68-
const renderFileNav = (file: File) => `<p><b>${file.path}</b></p>
68+
const renderFileNav = (file: File) => `<p><a href="#${
69+
file.path
70+
}" class="file-name"><b>${file.path}</b></a></p>
6971
<ul class="list-unstyled ml-0">
7072
${file.methods
7173
.map(
7274
method =>
73-
`<li><a href="#${method.slug}" class="${
75+
`<li class="method-name"><a href="#${method.slug}" class="${
7476
method.private ? 'text-muted' : ''
7577
}">${method.name}</a></li>`
7678
)
7779
.join('')}
7880
</ul>`;
7981

8082
const renderFile = (file: File) =>
81-
`${file.methods.map(method => renderMethod(method)).join('')}`;
83+
`<a name="${file.path}" />
84+
${file.methods.map(method => renderMethod(method)).join('')}`;
8285

8386
export default async (doc: Doc): Promise<string> => `<!DOCTYPE html>
8487
<html>
@@ -104,21 +107,33 @@ export default async (doc: Doc): Promise<string> => `<!DOCTYPE html>
104107
font-size: 3.5rem;
105108
}
106109
110+
.pkg-name a {
111+
text-decoration: none;
112+
}
113+
107114
.pkg-description {
108115
font-size: 1.5rem;
109116
font-weight: 200;
110117
}
111118
112-
.method-name {
119+
nav .file-name {
120+
color: #E54D89;
121+
}
122+
123+
nav .method-name {
124+
margin: 0.25rem 0;
125+
}
126+
127+
main .method-name {
113128
position: relative;
114129
}
115130
116-
.method-scope {
131+
main .method-scope {
117132
font-size: 1.5rem;
118133
color: #999;
119134
}
120135
121-
.method-permalink {
136+
main .method-permalink {
122137
position: absolute;
123138
margin-left: -1em;
124139
font-weight: normal;
@@ -146,19 +161,19 @@ export default async (doc: Doc): Promise<string> => `<!DOCTYPE html>
146161
147162
<div class="container">
148163
<div class="row">
149-
<div class="p-5 col-md-3">
164+
<nav class="p-5 col-md-3">
150165
${doc.files
151166
.filter(file => file.methods.length)
152167
.map(file => renderFileNav(file))
153168
.join('')}
154-
</div>
169+
</nav>
155170
156-
<div class="p-5 col-md-9">
171+
<main class="p-5 col-md-9">
157172
${doc.files
158173
.filter(file => file.methods.length)
159174
.map(file => renderFile(file))
160175
.join('')}
161-
</div>
176+
</main>
162177
</div>
163178
</div>
164179

0 commit comments

Comments
 (0)