Skip to content

Commit 7786037

Browse files
authored
feat: Redesign (#40)
* Improve README a bit * Add python check to makefile * Refactor fontawesome files * First sweep of color changes * Add new fonts * Update header font usage * use Noto Sans Mono for 'code' * Various styling adjustments * Various styling adjustments * remove unused CSS * Update dependencies * refine footer style * Update generator * replace halfmoon js with custom JS * add new tooltip for copy * formatting * Adjust menu style
1 parent 96f984b commit 7786037

36 files changed

+616
-450
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ site:
22
./crddocs-generator/build-site.sh repos.yaml template static site
33

44
serve:
5+
@command -v python >/dev/null 2>&1 || { echo >&2 "Python is not installed. Aborting."; exit 1; }
56
sleep 1 && xdg-open 'http://localhost:8000' &
67
python -m http.server --directory site
78

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Stackable CRD docs
22

3-
Generated with https://github.com/stackabletech/crddocs-generator (have a look there for how it works)
3+
https://crds.stackable.tech/
44

55
## Building
66

77
run `make`, the site is generated in the `site` directory.
88

9+
Generated with https://github.com/stackabletech/crddocs-generator (have a look there for how it works).
10+
911
## Configuring
1012

11-
configure the repos and versions in the `repo.yaml`.
13+
Configure the repos and versions in the `repo.yaml`.
1214

1315
HTML templates are in the `template` dir, styling in `static`.
1416

js/doc.js

+31-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import ClipboardJS from 'clipboard'
44
import { render } from 'react-dom'
55
import DOMPurify from 'dompurify'
66
import { html } from 'htm/react'
7-
import halfmoon from 'halfmoon'
87
import slugify from 'slugify'
98
import { marked } from 'marked'
109

1110
// Syntax highlighting imports
12-
import { getHighlighterCore } from 'shiki/core'
11+
import { createHighlighterCore } from 'shiki/core'
1312
import dracula from 'shiki/themes/dracula.mjs'
14-
import { getWasmInlined } from 'shiki/wasm'
13+
import getWasm from 'shiki/wasm'
1514
import yaml from 'shiki/langs/yaml.mjs'
1615

1716
const supportedLangs = ['yaml'];
@@ -20,14 +19,37 @@ window.bus = bus;
2019

2120
const clipboard = new ClipboardJS('.copy-url');
2221
clipboard.on('success', e => {
23-
halfmoon.initStickyAlert({
24-
content: "Copied Link!",
25-
timeShown: 2000
26-
})
22+
// Get the button that was clicked
23+
var button = e.trigger;
24+
25+
// Create the tooltip
26+
var tooltip = document.createElement('span');
27+
tooltip.className = 'tooltip';
28+
tooltip.innerHTML = 'Copied!';
29+
button.appendChild(tooltip);
30+
31+
// Show the tooltip
32+
setTimeout(function() {
33+
tooltip.classList.add('show');
34+
}, 50);
35+
36+
// Hide the tooltip after 2 seconds and remove it
37+
setTimeout(function() {
38+
tooltip.classList.remove('show');
39+
setTimeout(function() {
40+
tooltip.remove();
41+
}, 10);
42+
}, 1500);
43+
44+
// Clear selection
45+
e.clearSelection();
46+
});
47+
clipboard.on('error', e => {
48+
console.error('Copy failed!');
2749
});
2850

29-
const highlighter = await getHighlighterCore({
30-
loadWasm: getWasmInlined,
51+
const highlighter = await createHighlighterCore({
52+
loadWasm: getWasm,
3153
themes: [dracula],
3254
langs: [yaml],
3355
})

js/nav.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
import halfmoon from 'halfmoon'
1+
function toggleMenu() {
2+
var menu = document.getElementById('operator-menu');
3+
menu.classList.toggle('active');
4+
}
25

3-
document.addEventListener('DOMContentLoaded', () => {
4-
halfmoon.onDOMContentLoaded()
5-
})
6+
window.toggleMenu = toggleMenu;
7+
8+
// Close the menu when clicking outside
9+
document.addEventListener('click', function(event) {
10+
var isClickInside = document.querySelector('#operator-menu-button').contains(event.target) ||
11+
document.querySelector('#operator-menu').contains(event.target);
12+
if (!isClickInside) {
13+
document.getElementById('operator-menu').classList.remove('active');
14+
}
15+
});

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
"build": "pnpm build:nav && pnpm build:home && pnpm build:org && pnpm build:doc"
88
},
99
"devDependencies": {
10-
"esbuild": "^0.21.1",
11-
"shiki": "^1.4.0"
10+
"esbuild": "^0.23.1",
11+
"shiki": "^1.14.1"
1212
},
1313
"dependencies": {
1414
"clipboard": "2.0.11",
1515
"dompurify": "3.0.6",
1616
"eventemitter3": "5.0.1",
17-
"halfmoon": "^1.1.1",
1817
"htm": "^3.1.1",
1918
"marked": "11.1.0",
2019
"react": "^16.14.0",

0 commit comments

Comments
 (0)