Remove crop icon from image grid, leave on single image
This commit is contained in:
@@ -8,7 +8,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
|
import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
|
||||||
import {PostEmbedViewContext} from '#/view/com/util/post-embeds/types'
|
import {PostEmbedViewContext} from '#/view/com/util/post-embeds/types'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Crop_Stroke2_Corner0_Rounded as Crop} from '#/components/icons/Crop'
|
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
type EventFunction = (index: number) => void
|
type EventFunction = (index: number) => void
|
||||||
@@ -37,11 +36,6 @@ export const GalleryItem: FC<GalleryItemProps> = ({
|
|||||||
const largeAltBadge = useLargeAltBadgeEnabled()
|
const largeAltBadge = useLargeAltBadgeEnabled()
|
||||||
const image = images[index]
|
const image = images[index]
|
||||||
const hasAlt = !!image.alt
|
const hasAlt = !!image.alt
|
||||||
const isCropped = React.useMemo(() => {
|
|
||||||
if (!image.aspectRatio) return true
|
|
||||||
const aspect = image.aspectRatio.width / image.aspectRatio.height
|
|
||||||
return aspect !== 1
|
|
||||||
}, [image.aspectRatio])
|
|
||||||
const hideBadges =
|
const hideBadges =
|
||||||
viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
|
viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
|
||||||
return (
|
return (
|
||||||
@@ -69,7 +63,7 @@ export const GalleryItem: FC<GalleryItemProps> = ({
|
|||||||
accessibilityIgnoresInvertColors
|
accessibilityIgnoresInvertColors
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
{(hasAlt || isCropped) && !hideBadges ? (
|
{hasAlt && !hideBadges ? (
|
||||||
<View
|
<View
|
||||||
accessible={false}
|
accessible={false}
|
||||||
style={[
|
style={[
|
||||||
@@ -92,18 +86,10 @@ export const GalleryItem: FC<GalleryItemProps> = ({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
]}>
|
]}>
|
||||||
{isCropped && (
|
<Text
|
||||||
<Crop
|
style={[a.font_heavy, largeAltBadge ? a.text_xs : {fontSize: 8}]}>
|
||||||
fill={t.atoms.text_contrast_high.color}
|
ALT
|
||||||
width={largeAltBadge ? 18 : 12}
|
</Text>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{hasAlt && (
|
|
||||||
<Text
|
|
||||||
style={[a.font_heavy, largeAltBadge ? a.text_xs : {fontSize: 8}]}>
|
|
||||||
ALT
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user