Skip to content

Commit

Permalink
feat(FilePreview)!: remove fullscreen mobile image preview (#2044)
Browse files Browse the repository at this point in the history
  • Loading branch information
mournfulCoroner authored Jan 15, 2025
1 parent bd68b1e commit 2bc111d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 137 deletions.
27 changes: 1 addition & 26 deletions src/components/FilePreview/FilePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '@gravity-ui/icons';

import {useActionHandlers, useUniqId} from '../../hooks';
import {useBoolean} from '../../hooks/private';
import {Icon} from '../Icon';
import type {IconData} from '../Icon';
import {Text} from '../Text';
Expand All @@ -23,7 +22,6 @@ import {block} from '../utils/cn';

import {FilePreviewAction} from './FilePreviewAction';
import type {FilePreviewActionProps} from './FilePreviewAction';
import {MobileImagePreview} from './MobileImagePreview/MobileImagePreview';
import type {FileType} from './types';
import {getFileType} from './utils';

Expand Down Expand Up @@ -66,7 +64,6 @@ export function FilePreview({
const id = useUniqId();

const [previewSrc, setPreviewSrc] = React.useState<string | undefined>(imageSrc);
const [isPreviewSheetVisible, showPreviewSheet, closePreviewSheet] = useBoolean(false);
const mobile = useMobile();
const type = getFileType(file);

Expand Down Expand Up @@ -94,28 +91,14 @@ export function FilePreview({
const isPreviewString = typeof previewSrc === 'string';
const hideActions = isPreviewString && mobile;

const handleClick: React.MouseEventHandler<HTMLDivElement> = React.useCallback(
(e) => {
if (onClick) {
onClick(e);
return;
}

if (mobile && isPreviewString) {
showPreviewSheet();
}
},
[isPreviewString, mobile, onClick, showPreviewSheet],
);

return (
<div className={cn(null, className)} data-qa={qa}>
<div
className={cn('card', {clickable, hoverable: clickable || withActions})}
role={clickable ? 'button' : undefined}
onKeyDown={clickable ? onKeyDown : undefined}
tabIndex={clickable ? 0 : undefined}
onClick={clickable ? handleClick : undefined}
onClick={onClick}
>
{isPreviewString ? (
<div className={cn('image-container')}>
Expand Down Expand Up @@ -151,14 +134,6 @@ export function FilePreview({
))}
</div>
) : null}

<MobileImagePreview
visible={isPreviewSheetVisible}
onClose={closePreviewSheet}
actions={actions}
previewSrc={previewSrc}
fileName={file.name}
/>
</div>
);
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 2bc111d

Please sign in to comment.