Skip to content

Commit 75bdd13

Browse files
committed
refactor: update RetryableImage component to use imgProps for dimensions and improve error state styling
1 parent 9c28f29 commit 75bdd13

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

examples/react-example/src/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ function App() {
6262
isVisible: true,
6363
options: [
6464
{
65-
type: "button",
6665
label: "Export",
6766
icon: <Icon boxSize={"5"} as={PiDownload} />,
6867
isVisible: true,

packages/imagekit-editor-dev/src/components/RetryableImage.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,11 @@ export default function RetryableImage(props: RetryableImageProps) {
255255
<Box ref={rootRef as any} position="relative" display="inline-block">
256256
{error ? (
257257
<Center
258-
w={props.width || "full"}
259-
h={props.height || 56}
258+
w={imgProps.width || "full"}
259+
h={imgProps.height || 24}
260260
borderWidth="0"
261261
borderRadius="md"
262+
minW={imgProps.minW ?? 32}
262263
>
263264
<Flex
264265
direction="column"
@@ -269,7 +270,12 @@ export default function RetryableImage(props: RetryableImageProps) {
269270
borderColor="gray.300"
270271
borderRadius={compactError ? "sm" : "md"}
271272
bg="gray.50"
273+
h={compactError ? "100%" : undefined}
272274
minH={compactError ? "auto" : "200px"}
275+
minW={imgProps.minW ?? 32}
276+
{...(imgProps.boxSize && { boxSize: imgProps.boxSize })}
277+
{...(imgProps.w && { w: imgProps.w })}
278+
{...(imgProps.h && { h: imgProps.h })}
273279
>
274280
<VStack spacing={compactError ? 1 : 3}>
275281
{!compactError && (
@@ -315,8 +321,9 @@ export default function RetryableImage(props: RetryableImageProps) {
315321
</>
316322
) : (
317323
<Center
318-
w={props.width || "full"}
319-
h={props.height || 56}
324+
w={imgProps.width || "full"}
325+
h={imgProps.height || 24}
326+
minW={imgProps.minW ?? 32}
320327
borderWidth="0"
321328
borderRadius="md"
322329
>

0 commit comments

Comments
 (0)