💄 front: remove arrow keys from preview if a single file available (#661)

This commit is contained in:
Eric Doughty-Papassideris
2024-09-26 16:25:26 +02:00
parent ac9700f9b5
commit c2f67c119f
@@ -63,6 +63,8 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
}, []);
useEffect(() => {
if (items.length < 2)
return () => {};
addShortcut({ shortcut: 'Right', handler: handleSwitchRight });
addShortcut({ shortcut: 'Left', handler: handleSwitchLeft });
@@ -146,22 +148,26 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
</div>
<div className="whitespace-nowrap flex items-center">
<Controls type={type} />
<Button
iconSize="lg"
className="ml-4 !rounded-full"
theme="dark"
size="lg"
icon={ArrowLeftIcon}
onClick={ handleSwitchLeft }
/>
<Button
iconSize="lg"
className="ml-4 !rounded-full"
theme="dark"
size="lg"
icon={ArrowRightIcon}
onClick={ handleSwitchRight }
/>
{items.length > 1 &&
<>
<Button
iconSize="lg"
className="ml-4 !rounded-full"
theme="dark"
size="lg"
icon={ArrowLeftIcon}
onClick={ handleSwitchLeft }
/>
<Button
iconSize="lg"
className="ml-4 !rounded-full"
theme="dark"
size="lg"
icon={ArrowRightIcon}
onClick={ handleSwitchRight }
/>
</>
}
<Button
iconSize="lg"
className="ml-4 !rounded-full"