Optimizations + minor cleanups
All checks were successful
Docker Deploy / build-and-push (push) Successful in 4m15s
All checks were successful
Docker Deploy / build-and-push (push) Successful in 4m15s
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import { Icon } from "astro-icon/components";
|
||||
import type {
|
||||
IconType,
|
||||
LucideIcon,
|
||||
AstroIconName,
|
||||
CustomIconComponent,
|
||||
} from "../types";
|
||||
import type { IconType, LucideIcon, AstroIconName } from "../types";
|
||||
|
||||
interface IconRendererProps {
|
||||
icon: IconType;
|
||||
@@ -22,10 +17,6 @@ function isAstroIconName(icon: IconType): icon is AstroIconName {
|
||||
return typeof icon === "string";
|
||||
}
|
||||
|
||||
function isCustomComponent(icon: IconType): icon is CustomIconComponent {
|
||||
return typeof icon === "function" && !isLucideIcon(icon);
|
||||
}
|
||||
|
||||
export default function IconRenderer({
|
||||
icon,
|
||||
size,
|
||||
@@ -41,11 +32,10 @@ export default function IconRenderer({
|
||||
return <Icon name={icon} class={className} {...props} />;
|
||||
}
|
||||
|
||||
if (isCustomComponent(icon)) {
|
||||
if (typeof icon === "function") {
|
||||
const CustomComponent = icon;
|
||||
return <CustomComponent class={className} {...props} />;
|
||||
}
|
||||
|
||||
// Fallback
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -32,26 +32,15 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) {
|
||||
}
|
||||
};
|
||||
|
||||
// Set initial path
|
||||
updatePath();
|
||||
|
||||
// Listen for Astro's view transition events
|
||||
const handleAstroNavigation = () => {
|
||||
updatePath();
|
||||
};
|
||||
|
||||
// Listen for astro:page-load event which fires after navigation completes
|
||||
document.addEventListener("astro:page-load", handleAstroNavigation);
|
||||
|
||||
// Also listen for astro:after-swap as a backup
|
||||
document.addEventListener("astro:after-swap", handleAstroNavigation);
|
||||
|
||||
// Listen for regular navigation events as fallback
|
||||
document.addEventListener("astro:page-load", updatePath);
|
||||
document.addEventListener("astro:after-swap", updatePath);
|
||||
window.addEventListener("popstate", updatePath);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("astro:page-load", handleAstroNavigation);
|
||||
document.removeEventListener("astro:after-swap", handleAstroNavigation);
|
||||
document.removeEventListener("astro:page-load", updatePath);
|
||||
document.removeEventListener("astro:after-swap", updatePath);
|
||||
window.removeEventListener("popstate", updatePath);
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function ResumeDownloadButton({
|
||||
Generating PDF...
|
||||
</>
|
||||
) : (
|
||||
<>Download Resume</>
|
||||
"Download Resume"
|
||||
)}
|
||||
</button>
|
||||
{error && <div class="mt-2 text-error text-sm">{error}</div>}
|
||||
|
||||
@@ -218,8 +218,8 @@ export default function ResumeSettingsModal({
|
||||
role="tab"
|
||||
class={`px-4 py-2 rounded-full text-sm font-bold transition-all duration-200 ${
|
||||
activeTab === "edit"
|
||||
? "btn btn-primary font-bold shadow-sm"
|
||||
: "text-base-content/70 hover:text-base-content font-bold hover:bg-base-200"
|
||||
? "btn btn-primary shadow-sm"
|
||||
: "text-base-content/70 hover:text-base-content hover:bg-base-200"
|
||||
}`}
|
||||
onClick={() => setActiveTab("edit")}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user