Skip to content

Commit

Permalink
refactor(sanity): remove redundant drag-related props
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed Oct 1, 2024
1 parent e9b68d6 commit 1aaf760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export const RatioBox = styled(Card)`
`

export const Overlay = styled(Flex)<{
$drag: boolean
$tone: Exclude<CardTone, 'inherit'>
}>(({$drag, $tone}) => {
}>(({$tone}) => {
const textColor = studioTheme.color.light[$tone].card.enabled.fg
const backgroundColor = rgba(studioTheme.color.light[$tone].card.enabled.bg, 0.8)

Expand All @@ -30,9 +29,9 @@ export const Overlay = styled(Flex)<{
left: 0;
right: 0;
bottom: 0;
backdrop-filter: ${$drag ? 'blur(10px)' : ''};
backdrop-filter: blur(10px);
color: ${$tone ? textColor : ''};
background-color: ${$drag ? backgroundColor : 'transparent'};
background-color: ${backgroundColor};
`
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export function ImagePreview(props: ComponentProps<typeof Card> & Props) {

return (
<RatioBox {...rest} tone="transparent">
{!isLoaded && (
<OverlayComponent cardTone="transparent" drag content={<LoadingBlock showText />} />
)}
{!isLoaded && <OverlayComponent cardTone="transparent" content={<LoadingBlock showText />} />}
<img
src={src}
data-testid="hotspot-image-input"
Expand All @@ -47,7 +45,6 @@ export function ImagePreview(props: ComponentProps<typeof Card> & Props) {
{drag && (
<OverlayComponent
cardTone={tone}
drag={drag}
content={
<>
<Box marginBottom={3}>
Expand Down Expand Up @@ -91,15 +88,13 @@ function getHoverTextTranslationKey({

function OverlayComponent({
cardTone,
drag,
content,
}: {
cardTone: Exclude<CardTone, 'inherit'>
drag: boolean
content: ReactNode
}) {
return (
<Overlay justify="flex-end" padding={3} $drag={drag} $tone={cardTone}>
<Overlay justify="flex-end" padding={3} $tone={cardTone}>
<FlexOverlay direction="column" align="center" justify="center">
{content}
</FlexOverlay>
Expand Down

0 comments on commit 1aaf760

Please sign in to comment.