Skip to content

Commit 8edb708

Browse files
committed
added click to scroll on cards and pointerevents on splash cursor
1 parent 3cd3381 commit 8edb708

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

.zero-ui/attributes.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export declare const bodyAttributes: {
33
"data-mobile-menu": string;
44
"data-phase": "1" | "2" | "3" | "4" | "5";
5-
"data-reveal": "false";
5+
"data-reveal": "false" | "true";
66
"data-scrolled": "down" | "up";
77
};
88

app/components/HeroScrollClick.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Link from "next/link"
2+
3+
export const HeroScrollClick: React.FC = () => {
4+
return (
5+
<Link
6+
href="#projects-grid"
7+
aria-label="Scroll to projects"
8+
className="absolute top-0 z-5 h-1/2 w-1/2 right-0 xs:top-5 sm:h-3/4 sm:top-0 md:right-1/20 lg:right-1/10 xl:right-1/20 reveal-true:pointer-events-none"
9+
/>
10+
)
11+
}

app/components/HeroV2.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { HeroScrollClick } from "./HeroScrollClick"
12
import { ActivityDot } from "./ui/ActivityDot"
23
import { AnimatedElement } from "./ui/AnimatedElement"
34
import { CallToActionButton } from "./ui/CallToActionButton"
@@ -40,7 +41,8 @@ export const HeroV2 = () => {
4041
<CallToActionButton />
4142
</div>
4243
{/* Don't remove this span */}
43-
<span data-stack-target-id className="xs:ml-[8%] [flex:1 _0_0px] xs:mt-20 mt-24 ml-[4%] h-1 w-2 sm:mt-11" />
44+
<span data-stack-target-id className="xs:ml-[8%] [flex:1 _0_0px] xs:mt-20 mt-24 ml-[4%] h-1 w-2 sm:mt-11 xl:ml-[16%]" />
45+
<HeroScrollClick />
4446

4547
{/* subtle background ellipse */}
4648
<div className="pointer-events-none absolute inset-y-0 left-1/3 -z-1 hidden w-full bg-radial from-indigo-100 via-transparent to-transparent blur-3xl md:block" />

app/components/ProjectsGrid.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function ProjectsGrid({ className }: { className?: string }) {
1818
const ref = useRef<HTMLDivElement>(null)
1919
const rawOffsets = useOffset(ids)
2020
const isMobile = useIsMobile()
21-
const responsiveScale = isMobile ? 0.34 : 0.7
21+
const responsiveScale = isMobile ? 0.34 : 0.8
2222
const [, setReveal] = useUI<"true" | "false">("reveal", "false")
2323

2424
const { scrollYProgress } = useScroll({
@@ -61,7 +61,7 @@ export function ProjectsGrid({ className }: { className?: string }) {
6161
setReveal(inView ? "true" : "false")
6262
},
6363
{
64-
threshold: isMobile ? 0.5 : 0.8,
64+
threshold: isMobile ? 0.5 : 0.4,
6565
}
6666
)
6767
observer.observe(element)
@@ -70,7 +70,7 @@ export function ProjectsGrid({ className }: { className?: string }) {
7070
}, [isMobile])
7171

7272
return (
73-
<section className={clsx("relative", className)} ref={ref}>
73+
<section id="projects-grid" className={clsx("relative scroll-mt-36", className)} ref={ref}>
7474
<div className="relative z-4 grid grid-cols-1 grid-rows-1 gap-4 md:grid-cols-2 md:grid-rows-2">
7575
<AnimatedCard
7676
key={"react-zero-ui"}

app/components/SplashCursor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,24 +1139,24 @@ export function SplashCursor({
11391139
return ((value - min) % range) + min
11401140
}
11411141

1142-
window.addEventListener("mousedown", (e) => {
1142+
window.addEventListener("pointerdown", (e) => {
11431143
const pointer = pointers[0]
11441144
const posX = scaleByPixelRatio(e.clientX)
11451145
const posY = scaleByPixelRatio(e.clientY)
11461146
updatePointerDownData(pointer, -1, posX, posY)
11471147
clickSplat(pointer)
11481148
})
11491149

1150-
function handleFirstMouseMove(e: MouseEvent) {
1150+
function handleFirstMouseMove(e: PointerEvent) {
11511151
const pointer = pointers[0]
11521152
const posX = scaleByPixelRatio(e.clientX)
11531153
const posY = scaleByPixelRatio(e.clientY)
11541154
const color = generateColor()
11551155
updateFrame()
11561156
updatePointerMoveData(pointer, posX, posY, color)
1157-
document.body.removeEventListener("mousemove", handleFirstMouseMove)
1157+
document.body.removeEventListener("pointermove", handleFirstMouseMove)
11581158
}
1159-
document.body.addEventListener("mousemove", handleFirstMouseMove)
1159+
document.body.addEventListener("pointermove", handleFirstMouseMove)
11601160

11611161
window.addEventListener("mousemove", (e) => {
11621162
const pointer = pointers[0]

public/icons.svg

Lines changed: 4 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)