[Web] Scale animation when clicking on images (#10305)

This commit is contained in:
Samuel Newman
2026-04-20 11:09:35 -07:00
committed by GitHub
parent b8cabfaae6
commit ae0c2e8697
2 changed files with 28 additions and 9 deletions
+17 -3
View File
@@ -13,7 +13,7 @@ import {Trans} from '@lingui/react/macro'
import {type Dimensions} from '#/lib/media/types' import {type Dimensions} from '#/lib/media/types'
import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge' import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme, web} from '#/alf'
import {ArrowsDiagonalOut_Stroke2_Corner0_Rounded as Fullscreen} from '#/components/icons/ArrowsDiagonal' import {ArrowsDiagonalOut_Stroke2_Corner0_Rounded as Fullscreen} from '#/components/icons/ArrowsDiagonal'
import {MediaInsetBorder} from '#/components/MediaInsetBorder' import {MediaInsetBorder} from '#/components/MediaInsetBorder'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -210,12 +210,17 @@ export function AutoSizedImage({
color: utils.alpha(t.atoms.bg.backgroundColor, 0.2), color: utils.alpha(t.atoms.bg.backgroundColor, 0.2),
foreground: true, foreground: true,
}} }}
style={[ style={({pressed}) => [
a.w_full, a.w_full,
a.rounded_md, a.rounded_md,
a.overflow_hidden, a.overflow_hidden,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
{aspectRatio: max ?? 1}, {aspectRatio: max ?? 1},
web([
a.transition_transform,
{transitionDuration: '200ms'},
pressed && {transform: [{scale: 0.99}]},
]),
]}> ]}>
{contents} {contents}
</Pressable> </Pressable>
@@ -237,7 +242,16 @@ export function AutoSizedImage({
color: utils.alpha(t.atoms.bg.backgroundColor, 0.2), color: utils.alpha(t.atoms.bg.backgroundColor, 0.2),
foreground: true, foreground: true,
}} }}
style={[a.h_full]}> style={({pressed}) => [
a.h_full,
a.rounded_md,
a.overflow_hidden,
web([
a.transition_transform,
{transitionDuration: '200ms'},
pressed && {transform: [{scale: 0.99}]},
]),
]}>
{contents} {contents}
</Pressable> </Pressable>
</ConstrainedImage> </ConstrainedImage>
+11 -6
View File
@@ -430,15 +430,20 @@ function GalleryImage({
color: utils.alpha(t.atoms.bg.backgroundColor, 0.2), color: utils.alpha(t.atoms.bg.backgroundColor, 0.2),
foreground: true, foreground: true,
}} }}
style={[ style={({pressed}) => [
a.rounded_md, a.rounded_md,
a.overflow_hidden, a.overflow_hidden,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
web({ web([
cursor: 'inherit', {
outline: 0, cursor: 'inherit',
border: 0, outline: 0,
}), border: 0,
},
a.transition_transform,
{transitionDuration: '200ms'},
pressed && {transform: [{scale: 0.99}]},
]),
]}> ]}>
<Image <Image
source={{uri: image.thumb}} source={{uri: image.thumb}}