3.0.0 - Dependency updates, improved typesafe config, improve typing
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m44s

This commit is contained in:
2025-09-22 15:07:03 -06:00
parent 6c9fabe770
commit 75931d4a43
20 changed files with 1353 additions and 1533 deletions

View File

@@ -1,5 +1,10 @@
import { Icon } from 'astro-icon/components';
import type { IconType, LucideIcon, AstroIconName, CustomIconComponent } from '../types';
import { Icon } from "astro-icon/components";
import type {
IconType,
LucideIcon,
AstroIconName,
CustomIconComponent,
} from "../types";
interface IconRendererProps {
icon: IconType;
@@ -10,32 +15,37 @@ interface IconRendererProps {
// Type guard functions
function isLucideIcon(icon: IconType): icon is LucideIcon {
return typeof icon === 'function' && icon.length <= 1; // Lucide icons are function components
return typeof icon === "function" && icon.length <= 1; // Lucide icons are function components
}
function isAstroIconName(icon: IconType): icon is AstroIconName {
return typeof icon === 'string';
return typeof icon === "string";
}
function isCustomComponent(icon: IconType): icon is CustomIconComponent {
return typeof icon === 'function' && !isLucideIcon(icon);
return typeof icon === "function" && !isLucideIcon(icon);
}
export default function IconRenderer({ icon, size, class: className, ...props }: IconRendererProps) {
export default function IconRenderer({
icon,
size,
class: className,
...props
}: IconRendererProps) {
if (isLucideIcon(icon)) {
const LucideComponent = icon;
return <LucideComponent size={size} class={className} {...props} />;
}
if (isAstroIconName(icon)) {
return <Icon name={icon} class={className} {...props} />;
}
if (isCustomComponent(icon)) {
const CustomComponent = icon;
return <CustomComponent class={className} {...props} />;
}
// Fallback
return null;
}
}

View File

@@ -1,6 +1,6 @@
import { useComputed, useSignal } from "@preact/signals";
import { useEffect } from "preact/hooks";
import { navigationItems } from "../config/data";
import { config } from "../config";
import type { LucideIcon } from "../types";
interface NavigationBarProps {
@@ -20,7 +20,7 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) {
});
// Filter out disabled navigation items
const enabledNavigationItems = navigationItems.filter(
const enabledNavigationItems = config.navigationItems.filter(
(item) => item.enabled !== false,
);

View File

@@ -9,7 +9,9 @@ interface Props {
const { project } = Astro.props;
---
<div class="card bg-accent text-accent-content w-full max-w-sm shrink shadow-md">
<div
class="card bg-accent text-accent-content w-full max-w-sm shrink shadow-md"
>
<div class="card-body break-words">
<h2
class="card-title text-xl md:text-2xl font-bold justify-center text-center break-words"

View File

@@ -1,26 +1,24 @@
---
import { Icon } from "astro-icon/components";
import { socialLinks } from "../config/data";
import { config } from "../config";
---
<div class="flex flex-row gap-3 text-3xl flex-wrap justify-center">
{
socialLinks.map((link) => {
return (
<a
href={link.url}
target={link.url.startsWith("http") ? "_blank" : undefined}
rel={
link.url.startsWith("http")
? "noopener noreferrer"
: undefined
}
aria-label={link.ariaLabel}
class="hover:text-primary transition-colors"
>
<Icon name={link.icon} />
</a>
);
})
config.socialLinks.map((link) => (
<a
href={link.url}
target={link.url.startsWith("http") ? "_blank" : undefined}
rel={
link.url.startsWith("http")
? "noopener noreferrer"
: undefined
}
aria-label={link.ariaLabel}
class="hover:text-primary transition-colors"
>
<Icon name={link.icon} />
</a>
))
}
</div>

View File

@@ -1,6 +1,6 @@
---
import { Icon } from "astro-icon/components";
import { techLinks } from "../config/data";
import { config } from "../config";
// Helper function to check if icon is a string (Astro icon)
function isAstroIcon(icon: any): icon is string {
@@ -8,9 +8,9 @@ function isAstroIcon(icon: any): icon is string {
}
---
<div class="flex flex-row gap-4 text-3xl flex-wrap justify-center">
<div class="flex flex-row gap-3 text-3xl flex-wrap justify-center">
{
techLinks.map((link) => {
config.techLinks.map((link) => {
if (isAstroIcon(link.icon)) {
return (
<a