Fix unused imports, fix deprecated func usage

This commit is contained in:
2024-03-10 09:15:00 -05:00
parent 4f15605d04
commit 11620446be
2 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ const getLinkClasses = (link: Link) => {
return clsx(baseClasses, {
// Classes for when the link is not the current page
"dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400": !isCurrent,
"dark:border-l-zinc-600 text-zinc-500 dark:hover:text-zinc-300 dark:text-zinc-400": !isCurrent,
// Classes for when the link is the current page
"dark:border-l-zinc-500 text-zinc-900 dark:text-zinc-200": isCurrent,
});
@@ -23,7 +23,7 @@ const sidebar = await get();
<nav aria-labelledby="grid-left" class="w-64 p-4 border-r dark:border-r-zinc-500">
<ul>
{sidebar.map(item => (item.header ?
<h2 class="mt-4 font-semibold text-slate-700 dark:text-slate-200">{item.text}</h2> :
<h2 class="mt-4 font-semibold text-zinc-700 dark:text-zinc-300">{item.text}</h2> :
<li class={getLinkClasses(item)}>
<a href={item.link}>{item.text}</a>
</li>))}
@@ -32,7 +32,7 @@ const sidebar = await get();
</aside>
<script is:inline>
window.addEventListener('DOMContentLoaded', (event) => {
window.addEventListener('DOMContentLoaded', () => {
var target = document.querySelector('[aria-current="page"]');
if (target && target.offsetTop > window.innerHeight - 100) {
document.querySelector('.nav-groups').scrollTop = target.offsetTop;

View File

@@ -1,4 +1,4 @@
import { getCollection, getEntries, type CollectionEntry } from "astro:content";
import { getCollection, type CollectionEntry } from "astro:content";
export type Link = {
text: string;
@@ -22,7 +22,7 @@ const headerOrder: Record<string, number> = {
*/
function toTitleCase(s: string): string {
return s.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
});
}