Tucker McKnight
Make themes work, some color tweaks, make directory nav links work on file page
1
import {branchesListItems} from '../dist/js_templates/common/htmlPage.js'
1
import branchesListItems from '../dist/js_templates/common/branchesListItems.js'
16 17 18 19 20
// window['currentTheme'] = localStorage.getItem("theme") || "auto"
window['currentTheme'] = "light"
element.innerHTML = `<i class="bi bi-brightness-high"></i>`
element.innerHTML = `<i class="bi bi-moon"></i>`
element.innerHTML = `<i class="bi bi-yin-yang"></i>`
16 17 18 19 20
window['currentTheme'] = localStorage.getItem("theme") || "auto"
element.innerHTML = `<span>&#x1F4A1;</span>`
element.innerHTML = `<span>&#x1F319;</span>`
element.innerHTML = `<span>&#x1F5A5;&#xFE0F;</span>`
0
0
export default (branches: Array<{name: string, href: string, date: string}>, defaultBranch: string, currentBranch: string): string => {
return branches.map((branch) => {
const currentBadge = currentBranch === branch.name ? '<div class="badge rounded-pill bg-primary mx-1">current</div>' : ''
const defaultBadge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-info text-dark mx-1">default</div>' : ''
return `<a href='${branch.href}' class='dropdown-item my-1'><span class="branch-dropdown-branch-name me-1">${branch.name}</span>${currentBadge}${defaultBadge}<span class="text-body d-block ms-2">updated ${branch.date}</span></a>`
}).join('')
}
1 2 3 4 5 6 7 8 9
export const branchesListItems = (branches: Array<{name: string, href: string, date: string}>, defaultBranch: string, currentBranch: string): string => {
return branches.map((branch) => {
const currentBadge = currentBranch === branch.name ? '<div class="badge rounded-pill bg-primary mx-1">current</div>' : ''
const defaultBadge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-info text-body mx-1">default</div>' : ''
return `<a href='${branch.href}' class='dropdown-item my-1'><span class="branch-dropdown-branch-name me-1">${branch.name}</span>${currentBadge}${defaultBadge}<span class="text-body d-block ms-2">updated ${branch.date}</span></a>`
}).join('')
}
1 2 3 4 5 6 7 8 9
import branchesListItems from './branchesListItems.ts'
// this still necessary?
26
href: nav.repoBranchHome(branch.name),
26
href: nav.repoBranchHome(branch.name) + '/' + data.nav.path,
39
<link href="https://unpkg.com/prismjs@1.20.0/themes/prism.css" rel="stylesheet" />
39
47
47
<link rel="stylesheet" id="prism-theme" type="text/css" href="${data.reposPath}/vendor/prism.css" />
63
<button class="branches nav-link d-inline-block btn dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
63
<button class="branches nav-link d-inline-block btn btn-bg dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
101
101
<div class="col-auto d-flex align-items-center">
<div class="dropdown">
<button class="dropdown-toggle btn shadow-none" id="dark-mode-switch" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<span>️</span>
</button>
<ul class="dropdown-menu">
<li><button class="btn shadow-none" data-theme-pref="light" onclick="toggleDarkMode(this)"><span class="me-1">💡</span>Light</button></li>
<li><button class="btn shadow-none" data-theme-pref="dark" onclick="toggleDarkMode(this)"><span class="me-1">🌙</span>Dark</button></li>
<li><button class="btn shadow-none" data-theme-pref="auto" onclick="toggleDarkMode(this)"><span class="me-1">🖥️</span>Match OS</button></li>
</ul>
</div>
</div>
14 15
<span class="bezel-gray px-1"><a href="#">🏠 ./</a></span>${
return `<span class="bezel-gray px-1"><a href="#">${dir}</a></span>`
14 15
<span class="bezel-gray px-1"><a href="${data.reposPath}/${data.fileInfo.repoName}/branches/${data.fileInfo.branchName}/files">🏠 ./</a></span>${
return `<span class="bezel-gray px-1"><a href="${data.reposPath}/${data.fileInfo.repoName}/branches/${data.fileInfo.branchName}/files/${arr.slice(0, index + 1).join('/')}">${dir}</a></span>`
39
<a href="${data.reposPath}/${slugify(data.fileInfo.repoName)}/branches/${slugify(data.fileInfo.branchName)}/files/${slugify(dir.fullPath)}.html">${getRelativePath(data.fileInfo.file, dir.name)}</a>
39
<a href="${data.reposPath}/${slugify(data.fileInfo.repoName)}/branches/${slugify(data.fileInfo.branchName)}/files/${dir.fullPath.split('/').map((pathPart) => slugify(pathPart)).join('/')}">${getRelativePath(data.fileInfo.file, dir.name)}</a>
25
<a href="${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${slugify(file.fullPath)}.html">${file.name}</a>
25
<a href="${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${file.fullPath.split('/').map((pathPart) => slugify(pathPart)).join('/')}">${file.name}</a>
310 311
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/files/${eleventyConfig.getFilter("slugify")(data.fileInfo.file)}.html`
path: "files",
310 311
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/files/${data.fileInfo.file.split('/').map((filePart) => eleventyConfig.getFilter("slugify")(filePart)).join('/')}/`
path: 'files',
405
path: "",
405
path: (data) => '', // ask about why empty string here shows up as a function
444
path: "patches/page1",
444
path: 'patches/page1',
481
path: "patches/page1",
481
path: 'patches/page1',
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
@use 'sass:color';
$body-color: #262626;
$font-family-base: serif;
$border-radius: 0;
$border-radius-sm: 0;
$border-radius-lg: 0;
$enable-transitions: false;
$gray: #EFF2E4;
$blue: #7388FA;
$lightblue: #73B2FA;
$purple: #B673FA;
$magenta: #E273FA;
$teal: #80F8D4;
$body-bg: $gray;
$primary: $blue;
$info: $teal;
$warning: $magenta;
$body-tertiary-bg: color.adjust($gray, $lightness: -5%);
$border-color: $lightblue;
$border-width: 2px;
@import "../node_modules/bootstrap/scss/bootstrap";
.bezel {
background-color: $blue;
border-top: 6px solid color.adjust($blue, $lightness: 15%);
border-left: 6px solid color.adjust($blue, $lightness: 13%);
border-bottom: 6px solid color.adjust($blue, $lightness: -10%);
border-right: 6px solid color.adjust($blue, $lightness: -13%);
}
.bezel-purple {
background-color: $purple;
border-top: 6px solid color.adjust($purple, $lightness: 15%);
border-left: 6px solid color.adjust($purple, $lightness: 13%);
border-bottom: 6px solid color.adjust($purple, $lightness: -10%);
border-right: 6px solid color.adjust($purple, $lightness: -13%);
}
.bezel-gray {
background-color: $gray;
border-top: 6px solid color.adjust($gray, $lightness: 15%);
border-left: 6px solid color.adjust($gray, $lightness: 13%);
border-bottom: 6px solid color.adjust($gray, $lightness: -10%);
border-right: 6px solid color.adjust($gray, $lightness: -13%);
}
.bezel-inset {
background-color: $gray;
border-bottom: 6px solid color.adjust($gray, $lightness: 15%);
border-right: 6px solid color.adjust($gray, $lightness: 13%);
border-top: 6px solid color.adjust($gray, $lightness: -10%);
border-left: 6px solid color.adjust($gray, $lightness: -13%);
}
.bezel-inset-purple {
background-color: $purple;
border-bottom: 6px solid color.adjust($purple, $lightness: 15%);
border-right: 6px solid color.adjust($purple, $lightness: 13%);
border-top: 6px solid color.adjust($purple, $lightness: -10%);
border-left: 6px solid color.adjust($purple, $lightness: -13%);
}
.no-right {
border-right: none !important;
}
.no-left {
border-left: none !important;
}
a {
color: $teal;
}
.btn {
font-family: sans-serif;
box-shadow: rgba(0, 0, 0, .6) 4px 6px;
}
.btn:hover:not(.shadow-none) {
transform: translateX(2px) translateY(4px);
box-shadow: rgba(0, 0, 0, 1) 2px 2px;
}
.btn:active:not(.shadow-none) {
transform: translateX(3px) translateY(5px);
box-shadow: rgba(0, 0, 0, 1) 1px 1px;
}
h1.blue {
color: $blue;
}
nav a, nav span {
font-family: sans-serif;
}
.nav-item a {
color: $purple;
}
.navbar-nav .nav-link.active {
background-color: $purple;
color: white;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
20
20
$secondary: $purple;
43
43
#dark-mode-switch span {
text-shadow: 0 0 12px $black;
}
@include color-mode(dark) {
$blue: #354BC6;
.bezel {
background-color: $blue;
border-top: 6px solid color.adjust($blue, $lightness: 10%);
border-left: 6px solid color.adjust($blue, $lightness: 7%);
border-bottom: 6px solid color.adjust($blue, $lightness: -15%);
border-right: 6px solid color.adjust($blue, $lightness: -18%);
}
.nav-item a {
color: $lightblue;
}
.btn-bg {
background-color: color.adjust($body-bg-dark, $lightness: 10%);
}
.list-group {
--bs-list-group-border-color: #404448;
}
.bezel-gray {
background-color: color.adjust($body-bg-dark, $lightness: 10%);
border-top: 6px solid color.adjust($body-bg-dark, $lightness: 15%);
border-left: 6px solid color.adjust($body-bg-dark, $lightness: 13%);
border-bottom: 6px solid color.adjust($body-bg-dark, $lightness: -5%);
border-right: 6px solid color.adjust($body-bg-dark, $lightness: -9%);
}
#dark-mode-switch span {
text-shadow: 0 0 12px $white;
}
}
52 53 54 55 56
background-color: $gray;
border-top: 6px solid color.adjust($gray, $lightness: 15%);
border-left: 6px solid color.adjust($gray, $lightness: 13%);
border-bottom: 6px solid color.adjust($gray, $lightness: -10%);
border-right: 6px solid color.adjust($gray, $lightness: -13%);
52 53 54 55 56
border-top: 6px solid color.adjust($body-bg, $lightness: 15%);
border-left: 6px solid color.adjust($body-bg, $lightness: 13%);
border-bottom: 6px solid color.adjust($body-bg, $lightness: -10%);
border-right: 6px solid color.adjust($body-bg, $lightness: -13%);
83 84 85
a {
color: $blue;
}
83 84 85
$link-color: $blue;
$link-color-dark: $lightblue;