feat(portfolio): add hero command deck with canvas signal grid
This commit is contained in:
@@ -6,17 +6,17 @@ import { HeroCanvas } from "./HeroCanvas";
|
||||
|
||||
const paletteEventName = "blacksite:palette";
|
||||
|
||||
function openCommandPalette() {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
window.dispatchEvent(new CustomEvent(paletteEventName));
|
||||
}
|
||||
|
||||
export function Hero() {
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
|
||||
const openCommandPalette = () => {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
window.dispatchEvent(new CustomEvent(paletteEventName));
|
||||
};
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby="hero-heading"
|
||||
|
||||
@@ -176,8 +176,10 @@ export function HeroCanvas() {
|
||||
};
|
||||
|
||||
resize();
|
||||
resizeObserver = new ResizeObserver(resize);
|
||||
resizeObserver.observe(canvas);
|
||||
if ("ResizeObserver" in window) {
|
||||
resizeObserver = new ResizeObserver(resize);
|
||||
resizeObserver.observe(canvas);
|
||||
}
|
||||
window.addEventListener("resize", resize, { passive: true });
|
||||
|
||||
if (!shouldReduceMotion) {
|
||||
|
||||
Reference in New Issue
Block a user