Skip to content

Commit 8a80ef2

Browse files
committed
refactor(sanity): remove redundant drag-related props
1 parent 14ebf2c commit 8a80ef2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

packages/sanity/src/core/form/inputs/files/ImageInput/ImagePreview.styled.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ export const RatioBox = styled(Card)`
1818
`
1919

2020
export const Overlay = styled(Flex)<{
21-
$drag: boolean
2221
$tone: Exclude<CardTone, 'inherit'>
23-
}>(({$drag, $tone}) => {
22+
}>(({$tone}) => {
2423
const textColor = studioTheme.color.light[$tone].card.enabled.fg
2524
const backgroundColor = rgba(studioTheme.color.light[$tone].card.enabled.bg, 0.8)
2625

@@ -30,9 +29,9 @@ export const Overlay = styled(Flex)<{
3029
left: 0;
3130
right: 0;
3231
bottom: 0;
33-
backdrop-filter: ${$drag ? 'blur(10px)' : ''};
32+
backdrop-filter: blur(10px);
3433
color: ${$tone ? textColor : ''};
35-
background-color: ${$drag ? backgroundColor : 'transparent'};
34+
background-color: ${backgroundColor};
3635
`
3736
})
3837

packages/sanity/src/core/form/inputs/files/ImageInput/ImagePreview.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export function ImagePreview(props: ComponentProps<typeof Card> & Props) {
3434

3535
return (
3636
<RatioBox {...rest} tone="transparent">
37-
{!isLoaded && (
38-
<OverlayComponent cardTone="transparent" drag content={<LoadingBlock showText />} />
39-
)}
37+
{!isLoaded && <OverlayComponent cardTone="transparent" content={<LoadingBlock showText />} />}
4038
<img
4139
src={src}
4240
data-testid="hotspot-image-input"
@@ -47,7 +45,6 @@ export function ImagePreview(props: ComponentProps<typeof Card> & Props) {
4745
{drag && (
4846
<OverlayComponent
4947
cardTone={tone}
50-
drag={drag}
5148
content={
5249
<>
5350
<Box marginBottom={3}>
@@ -91,15 +88,13 @@ function getHoverTextTranslationKey({
9188

9289
function OverlayComponent({
9390
cardTone,
94-
drag,
9591
content,
9692
}: {
9793
cardTone: Exclude<CardTone, 'inherit'>
98-
drag: boolean
9994
content: ReactNode
10095
}) {
10196
return (
102-
<Overlay justify="flex-end" padding={3} $drag={drag} $tone={cardTone}>
97+
<Overlay justify="flex-end" padding={3} $tone={cardTone}>
10398
<FlexOverlay direction="column" align="center" justify="center">
10499
{content}
105100
</FlexOverlay>

0 commit comments

Comments
 (0)