Skip to content

Commit

Permalink
feat(Stack): Support for opening links
Browse files Browse the repository at this point in the history
  • Loading branch information
alimoezzi committed Sep 13, 2022
1 parent b944b56 commit 26dc0cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Stack/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function Stack({
outlineOpacity={springs[i].opacity}
onPointerOver={() => addGlow(i)}
onPointerLeave={() => api.start(() => ({ opacity: 0 }))}
onClick={() => c.link && window.open(c.link, '_blank', 'noopener,noreferrer')}
position-y={-0.2}>
{c.title}
<meshStandardMaterial color='white' />
Expand Down Expand Up @@ -144,6 +145,7 @@ export function Stack({
outlineOpacity={springs[i].opacity}
onPointerOver={() => addGlow(i)}
onPointerLeave={() => api.start(() => ({ opacity: 0 }))}
onClick={() => c.link && window.open(c.link, '_blank', 'noopener,noreferrer')}
position-y={-0.1}>
{c.title}
<meshStandardMaterial color='white' />
Expand Down Expand Up @@ -230,6 +232,7 @@ export function Stack({
outlineOpacity={springs[i].opacity}
onPointerOver={() => addGlow(i)}
onPointerLeave={() => api.start(() => ({ opacity: 0 }))}
onClick={() => c.link && window.open(c.link, '_blank', 'noopener,noreferrer')}
position-y={-0.2}>
{c.title}
<meshStandardMaterial color='white' />
Expand Down Expand Up @@ -343,15 +346,15 @@ export function Stack({
}
}}
onPointerOver={() => {
if (!('ontouchstart' in window)) {
if (!window.matchMedia('(pointer: coarse)').matches) {
addGlow(i)
const newHovered = Array(content.length).fill(false)
newHovered[i] = true
setHovered(newHovered)
}
}}
onPointerLeave={() => {
if (!('ontouchstart' in window)) {
if (!window.matchMedia('(pointer: coarse)').matches) {
api.start(() => ({ opacity: 0 }))
}
}}
Expand Down

0 comments on commit 26dc0cb

Please sign in to comment.