Fixing width bug

This commit is contained in:
Sean Edmunds
2025-07-10 14:43:25 -05:00
parent c0b020a569
commit 1d13161e9a

View File

@@ -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}