Fixing width bug
This commit is contained in:
@@ -39,6 +39,7 @@ function BackgroundModal({
|
|||||||
inUseBackgrounds: string[];
|
inUseBackgrounds: string[];
|
||||||
}) {
|
}) {
|
||||||
const { ref, width } = useElementSize();
|
const { ref, width } = useElementSize();
|
||||||
|
const [backgroundWidth, setBackgroundWidth] = useState<number>(width || 0);
|
||||||
const [background, setBackground] = useState<File | null>(null);
|
const [background, setBackground] = useState<File | null>(null);
|
||||||
const [fileName, setFileName] = useState<string>('');
|
const [fileName, setFileName] = useState<string>('');
|
||||||
const [newFileName, setNewFileName] = useState<string>('');
|
const [newFileName, setNewFileName] = useState<string>('');
|
||||||
@@ -62,6 +63,11 @@ function BackgroundModal({
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [debouncedSearch]);
|
}, [debouncedSearch]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (width) {
|
||||||
|
setBackgroundWidth(width);
|
||||||
|
}
|
||||||
|
}, [width]);
|
||||||
return (
|
return (
|
||||||
<Modal.Root
|
<Modal.Root
|
||||||
size={'75%'}
|
size={'75%'}
|
||||||
@@ -200,7 +206,7 @@ function BackgroundModal({
|
|||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
maxWidth: width,
|
maxWidth: backgroundWidth,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{background}
|
{background}
|
||||||
|
|||||||
Reference in New Issue
Block a user