Skip to content

Commit abed66b

Browse files
Wojciech KrysiakWojciech Krysiak
authored andcommitted
feat: add paranoid software-brothers
1 parent 7bc6fb2 commit abed66b

File tree

15 files changed

+254
-269
lines changed

15 files changed

+254
-269
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ Example configuration file with settings for both `default` and `better-docs` te
592592
}
593593
},
594594
"better-docs": {
595+
"softwareBrothers": "slightly-paranoid",
595596
"name": "AdminBro Documentation",
596597
"logo": "images/logo.png",
597598
"title": "", // HTML title

publish.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ exports.publish = function (taffyData, opts, tutorials) {
294294
conf.default = conf.default || {}
295295
conf.betterDocs = conf.betterDocs || conf['better-docs'] || {}
296296

297+
if (typeof conf.betterDocs.softwareBrothers === 'undefined') {
298+
conf.betterDocs.softwareBrothers = true
299+
}
300+
297301
templatePath = path.normalize(opts.template)
298302
view = new Template(path.join(templatePath, 'tmpl'))
299303

scripts/side-nav.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const OFFSET = 150
22

33
$().ready(() => {
44
const wrapper = $('#side-nav')
5+
const wrapperMenu = wrapper.find('.side-menu')
56

67
/**
78
* @type {Array<{link: El, offset: number}>}
@@ -16,28 +17,31 @@ $().ready(() => {
1617
const section = $(el)
1718
const sectionName = section.find('> h1').text()
1819
if (sectionName) {
19-
wrapper.append($('<h3/>').text(sectionName))
20+
wrapperMenu.append($('<h3/>').text(sectionName))
2021
const list = $('<ul></ul>')
2122
section.find('.members h4.name').each((i, el) => {
2223
const navLink = $(el)
2324
const name = navLink.find('.code-name')
24-
.clone().children().remove().end().text()
25+
.clone().children().remove()
26+
.end()
27+
.text()
2528
const href = navLink.find('a').attr('href')
2629
const link = $(`<a href="${href}" />`).text(name)
2730
list.append($('<li></li>').append(link))
28-
links.push({ link, offset: navLink.offset().top})
31+
links.push({ link, offset: navLink.offset().top })
2932
})
30-
wrapper.append(list)
31-
}
32-
else {
33+
wrapperMenu.append(list)
34+
} else {
3335
section.find('.members h4.name').each((i, el) => {
3436
const navLink = $(el)
3537
const name = navLink.find('.code-name')
36-
.clone().children().remove().end().text()
38+
.clone().children().remove()
39+
.end()
40+
.text()
3741
const href = navLink.find('a').attr('href')
3842
const link = $(`<a href="${href}" />`).text(name)
39-
wrapper.append(link)
40-
links.push({ link, offset: navLink.offset().top})
43+
wrapperMenu.append(link)
44+
links.push({ link, offset: navLink.offset().top })
4145
})
4246
}
4347
})
@@ -47,11 +51,11 @@ $().ready(() => {
4751
}
4852

4953
const core = $('#main-content-wrapper')
50-
54+
5155
const selectOnScroll = () => {
5256
const position = core.scrollTop()
5357
let activeSet = false
54-
for (let index = (links.length-1); index >= 0; index--) {
58+
for (let index = (links.length - 1); index >= 0; index--) {
5559
const link = links[index]
5660
link.link.removeClass('is-active')
5761
if ((position + OFFSET) >= link.offset) {
@@ -70,9 +74,9 @@ $().ready(() => {
7074

7175
selectOnScroll()
7276

73-
links.forEach(link => {
77+
links.forEach((link) => {
7478
link.link.click(() => {
7579
core.animate({ scrollTop: link.offset - OFFSET + 1 }, 500)
7680
})
7781
})
78-
})
82+
})

src/better-docs.type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,9 @@ export type BetterDocsConfig = {
8181
* Navigation links
8282
*/
8383
navLinks: Array<NavLink>;
84+
85+
/**
86+
* Indicates if SoftwareBrothers logo should be seen in the UI
87+
*/
88+
softwareBrothers?: false | true | 'slightly-paranoid' | 'paranoid';
8489
}

static/images/sb-paranoid.svg

Lines changed: 20 additions & 0 deletions
Loading

static/images/software-brothers-sidebar.svg

Lines changed: 11 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)