Skip to content

Commit 936d7e6

Browse files
Redesign docs site with Tailwind and dark mode
Migrates the documentation site to a new Tailwind CSS-based design with improved accessibility, dark mode support, and a modernized layout. Adds theme toggle and mobile navigation, updates index and static page templates, introduces a new Tailwind CSS source, and updates the GitHub Actions workflow to build CSS assets using Node.js. Also adds package.json and Tailwind config for asset building.
1 parent 1b11027 commit 936d7e6

8 files changed

Lines changed: 990 additions & 895 deletions

File tree

.github/workflows/update-assets.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ jobs:
1212
uses: "actions/checkout@v2.3.4"
1313
with:
1414
ref: master
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build Tailwind CSS
26+
run: npm run build:css
27+
1528
- name: "Bump version based on manifest"
1629
working-directory: assets
1730
shell: pwsh

assets/css/tailwind-source.css

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
:root {
6+
/* Light mode defaults */
7+
--color-bg: #FFFFFF;
8+
--color-bg-secondary: #F8F9FA;
9+
--color-text: #0E1A2F;
10+
--color-text-secondary: #273B59;
11+
--color-border: #C5D1E3;
12+
--color-primary: #045BDB;
13+
}
14+
15+
.dark {
16+
/* Dark mode overrides */
17+
--color-bg: #0E1A2F;
18+
--color-bg-secondary: #0B234A;
19+
--color-text: #FFFFFF;
20+
--color-text-secondary: #C5D1E3;
21+
--color-border: #273B59;
22+
--color-primary: #60A5FA;
23+
}
24+
25+
/* Custom animations */
26+
@keyframes shimmer {
27+
0% { background-position: -1000px 0; }
28+
100% { background-position: 1000px 0; }
29+
}
30+
31+
@keyframes fadeInUp {
32+
from {
33+
opacity: 0;
34+
transform: translateY(20px);
35+
}
36+
to {
37+
opacity: 1;
38+
transform: translateY(0);
39+
}
40+
}
41+
42+
.animate-shimmer {
43+
animation: shimmer 20s linear infinite;
44+
}
45+
46+
.animate-fade-in-up {
47+
animation: fadeInUp 0.6s ease-out;
48+
}
49+
50+
/* Custom utilities */
51+
@layer utilities {
52+
.text-balance {
53+
text-wrap: balance;
54+
}
55+
56+
.scrollbar-hide {
57+
-ms-overflow-style: none;
58+
scrollbar-width: none;
59+
}
60+
61+
.scrollbar-hide::-webkit-scrollbar {
62+
display: none;
63+
}
64+
}
65+
66+
/* Preserve existing custom styles for docs */
67+
.back-to-top {
68+
position: fixed;
69+
bottom: 20px;
70+
right: 20px;
71+
display: none;
72+
}
73+
74+
h5.param {
75+
background-color: var(--color-bg-secondary);
76+
font-family: var(--font-mono);
77+
display: inline-block;
78+
padding: 0.25rem 0.5rem;
79+
border-radius: 0.25rem;
80+
}
81+
82+
.table td:first-child {
83+
width: 10em;
84+
}
85+
86+
/* Syntax highlighting overrides */
87+
code.hljs-inline {
88+
display: inline;
89+
}
90+
91+
code.wrapped {
92+
white-space: pre-wrap;
93+
}

assets/js/theme-toggle.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Dark mode theme toggle functionality
2+
(function() {
3+
// Initialize theme from localStorage or default to dark
4+
const savedTheme = localStorage.getItem('theme') || 'dark';
5+
const html = document.documentElement;
6+
7+
if (savedTheme === 'dark') {
8+
html.classList.add('dark');
9+
} else {
10+
html.classList.remove('dark');
11+
}
12+
13+
// Toggle function
14+
window.toggleTheme = function() {
15+
const html = document.documentElement;
16+
const isDark = html.classList.contains('dark');
17+
18+
if (isDark) {
19+
html.classList.remove('dark');
20+
localStorage.setItem('theme', 'light');
21+
} else {
22+
html.classList.add('dark');
23+
localStorage.setItem('theme', 'dark');
24+
}
25+
};
26+
27+
// Mobile menu toggle
28+
window.toggleMobileMenu = function() {
29+
const mobileMenu = document.getElementById('mobile-menu');
30+
if (mobileMenu) {
31+
mobileMenu.classList.toggle('hidden');
32+
}
33+
};
34+
})();

assets/templates/index.html.template

Lines changed: 305 additions & 533 deletions
Large diffs are not rendered by default.

assets/templates/page_template_static.html.template

Lines changed: 443 additions & 362 deletions
Large diffs are not rendered by default.

assets/templates/to_md.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ function Split-ArrayInParts($array, [int]$parts) {
256256
$rtn
257257
}
258258

259+
# Build Tailwind CSS before generating pages
260+
Write-Host "Building Tailwind CSS..." -ForegroundColor Cyan
261+
$repoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..'))
262+
Push-Location $repoRoot
263+
try {
264+
if (Test-Path "node_modules") {
265+
& npm run build:css
266+
Write-Host "CSS build complete." -ForegroundColor Green
267+
} else {
268+
Write-Warning "Node modules not found. Run 'npm install' first. Skipping CSS build."
269+
}
270+
} catch {
271+
Write-Warning "Error building CSS: $_. Continuing anyway..."
272+
} finally {
273+
Pop-Location
274+
}
275+
259276
$sw = [System.Diagnostics.Stopwatch]::StartNew()
260277

261278
#get json index path

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "dbatools-docs",
3+
"version": "1.0.0",
4+
"description": "dbatools command documentation",
5+
"scripts": {
6+
"build:css": "tailwindcss -i ./assets/css/tailwind-source.css -o ./assets/css/tailwind.css --minify",
7+
"watch:css": "tailwindcss -i ./assets/css/tailwind-source.css -o ./assets/css/tailwind.css --watch",
8+
"build": "npm run build:css"
9+
},
10+
"devDependencies": {
11+
"@tailwindcss/typography": "^0.5.19",
12+
"autoprefixer": "^10.4.21",
13+
"postcss": "^8.5.6",
14+
"tailwindcss": "^3.4.18"
15+
}
16+
}

tailwind.config.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
"./assets/templates/**/*.{html,template}",
5+
"./assets/css/**/*.css"
6+
],
7+
darkMode: 'class',
8+
theme: {
9+
extend: {
10+
colors: {
11+
primary: {
12+
DEFAULT: '#045BDB',
13+
dark: '#0B234A',
14+
},
15+
accent: {
16+
red: '#FF5F56',
17+
yellow: '#FFBD2E',
18+
green: '#27C93F',
19+
},
20+
theme: {
21+
bg: {
22+
DEFAULT: '#FFFFFF',
23+
dark: '#0E1A2F'
24+
},
25+
card: {
26+
DEFAULT: '#F8F9FA',
27+
dark: '#0B234A'
28+
},
29+
border: {
30+
DEFAULT: '#C5D1E3',
31+
dark: '#273B59'
32+
},
33+
text: {
34+
DEFAULT: '#0E1A2F',
35+
secondary: '#273B59',
36+
dark: '#FFFFFF',
37+
'secondary-dark': '#C5D1E3'
38+
}
39+
}
40+
},
41+
fontFamily: {
42+
sans: ['Inter', 'system-ui', '-apple-system', 'sans-serif'],
43+
mono: ['JetBrains Mono', 'Menlo', 'Monaco', 'monospace'],
44+
},
45+
fontSize: {
46+
'hero': ['clamp(2.5rem, 5vw, 4.5rem)', { lineHeight: '1.1', letterSpacing: '-0.03em', fontWeight: '700' }],
47+
'display': ['clamp(2rem, 4vw, 3rem)', { lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: '600' }],
48+
'title': ['clamp(1.5rem, 3vw, 2rem)', { lineHeight: '1.3', letterSpacing: '-0.01em', fontWeight: '600' }],
49+
},
50+
animation: {
51+
'fade-in': 'fadeIn 0.6s ease-out',
52+
'slide-up': 'slideUp 0.6s ease-out',
53+
},
54+
keyframes: {
55+
fadeIn: {
56+
'0%': { opacity: '0' },
57+
'100%': { opacity: '1' }
58+
},
59+
slideUp: {
60+
'0%': { opacity: '0', transform: 'translateY(20px)' },
61+
'100%': { opacity: '1', transform: 'translateY(0)' }
62+
},
63+
}
64+
},
65+
},
66+
plugins: [
67+
require('@tailwindcss/typography'),
68+
],
69+
}

0 commit comments

Comments
 (0)