Skip to content

Commit 8b0bb6b

Browse files
committed
feat: add beforeSidebar option
1 parent d00629b commit 8b0bb6b

File tree

9 files changed

+300
-646
lines changed

9 files changed

+300
-646
lines changed

docs/README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,14 @@ docup.init({
138138
})
139139
```
140140

141+
Available languages:
142+
141143
```js preact
142144
import { useState, html } from 'docup'
143145
export default ({ langs }) => {
144-
const [show, setShow] = useState(false)
145-
return html`<div>
146-
${show &&
147-
html`<ul>
148-
${langs.map((lang) => html`<li key="{lang}">${lang}</li>`)}
149-
</ul>`}
150-
<button
151-
style="margin-top:20px;border:1px solid; font-size: 14px; padding:5px;"
152-
onClick=${() => setShow(!show)}
153-
>
154-
Show ${show ? 'hide languages' : 'all supported languages'}..
155-
</button>
156-
</div>`
146+
return html`<select>
147+
${langs.map((lang) => html`<option key="{lang}">${lang}</option>`)}
148+
</select>`
157149
}
158150
```
159151

@@ -482,6 +474,12 @@ export default ({ count }) => {
482474

483475
Follow system theme, i.e. use dark theme when system theme is dark.
484476

477+
#### beforeSidebar
478+
479+
- Type: `string`
480+
481+
HTML string to display before sidebar.
482+
485483
## Browser support
486484

487485
Last 2 versions of modern browsers.

docs/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ init({
88
props: {
99
langs: PRISM_LANGUAGES,
1010
},
11+
beforeSidebar: `<div style="background:#f9f9f9;padding: 20px;">
12+
<div>
13+
<strong style="font-size: 0.8rem;color:#ccc;">SPONSOR</strong>
14+
</div>
15+
<a href="https://browserku.com" rel="nofollow noopener" target="_blank"
16+
title="API for web scraping, screenshots, PDF generation and more"
17+
><img src="https://cdn.jsdelivr.net/gh/egoist-bot/images@main/upic/b38Wz1.png"
18+
/></a>
19+
</div>`,
1120
navLinks: [
1221
{
1322
text: 'Guide',

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"devDependencies": {
3939
"@egoist/rollup-plugin-ts-resolve": "^0.1.0",
40-
"@prefresh/vite": "^2.2.4",
40+
"@prefresh/vite": "^2.2.8",
4141
"@rollup/plugin-alias": "^3.1.2",
4242
"@rollup/plugin-commonjs": "^17.1.0",
4343
"@rollup/plugin-node-resolve": "^11.2.0",
@@ -46,16 +46,16 @@
4646
"@types/prismjs": "^1.16.3",
4747
"cross-env": "7.0.3",
4848
"debug": "^4.3.1",
49-
"esbuild": "^0.14.2",
49+
"esbuild": "^0.14.51",
5050
"esbuild-register": "^3.2.0",
5151
"fre": "^2.0.4",
5252
"postcss-nested": "^5.0.6",
5353
"prettier": "^2.2.1",
5454
"rollup": "^2.61.0",
5555
"rollup-plugin-dts": "^4.0.1",
56-
"tailwindcss": "^2.2.19",
56+
"tailwindcss": "^3.1.7",
5757
"type-fest": "^0.21.2",
5858
"typescript": "^4.2.3",
59-
"vite": "^2.7.1"
59+
"vite": "^3.0.4"
6060
}
6161
}

0 commit comments

Comments
 (0)