diff --git a/src/components/FilePreview/FilePreview.tsx b/src/components/FilePreview/FilePreview.tsx index 755d47b126..18ba24e4e7 100644 --- a/src/components/FilePreview/FilePreview.tsx +++ b/src/components/FilePreview/FilePreview.tsx @@ -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'; @@ -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'; @@ -66,7 +64,6 @@ export function FilePreview({ const id = useUniqId(); const [previewSrc, setPreviewSrc] = React.useState(imageSrc); - const [isPreviewSheetVisible, showPreviewSheet, closePreviewSheet] = useBoolean(false); const mobile = useMobile(); const type = getFileType(file); @@ -94,20 +91,6 @@ export function FilePreview({ const isPreviewString = typeof previewSrc === 'string'; const hideActions = isPreviewString && mobile; - const handleClick: React.MouseEventHandler = React.useCallback( - (e) => { - if (onClick) { - onClick(e); - return; - } - - if (mobile && isPreviewString) { - showPreviewSheet(); - } - }, - [isPreviewString, mobile, onClick, showPreviewSheet], - ); - return (
{isPreviewString ? (
@@ -151,14 +134,6 @@ export function FilePreview({ ))}
) : null} - -
); } diff --git a/src/components/FilePreview/MobileImagePreview/MobileImagePreview.scss b/src/components/FilePreview/MobileImagePreview/MobileImagePreview.scss deleted file mode 100644 index bdf97930f9..0000000000 --- a/src/components/FilePreview/MobileImagePreview/MobileImagePreview.scss +++ /dev/null @@ -1,45 +0,0 @@ -@use '../../variables'; -@use '../../../../styles/mixins'; - -$block: '.#{variables.$ns}mobile-image-preview'; - -#{$block} { - $previewButtonsTop: 15px; - - &__sheet-content { - padding: 0; - } - - &__container { - height: 85vh; - position: relative; - display: flex; - align-items: center; - justify-content: center; - } - - &__image { - width: auto; - max-width: 100%; - max-height: 100%; - } - - &__back-button { - position: absolute; - inset-block-start: $previewButtonsTop; - inset-inline-start: 15px; - } - - &__action-buttons { - position: absolute; - inset-block-start: $previewButtonsTop; - inset-inline-end: 15px; - display: flex; - flex-direction: column-reverse; - gap: 12px; - } - - &__error-label { - @include mixins.text-body-2; - } -} diff --git a/src/components/FilePreview/MobileImagePreview/MobileImagePreview.tsx b/src/components/FilePreview/MobileImagePreview/MobileImagePreview.tsx deleted file mode 100644 index b01422bc21..0000000000 --- a/src/components/FilePreview/MobileImagePreview/MobileImagePreview.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import * as React from 'react'; - -import {ArrowLeft as ArrowLeftIcon} from '@gravity-ui/icons'; - -import {Button} from '../../Button'; -import {Icon} from '../../Icon'; -import {Sheet} from '../../Sheet'; -import {block} from '../../utils/cn'; -import type {FilePreviewActionProps} from '../FilePreviewAction'; -import i18n from '../i18n'; - -import './MobileImagePreview.scss'; - -const cn = block('mobile-image-preview'); - -export interface FilePreviewProps { - fileName?: string; - previewSrc?: string; - visible: boolean; - onClose: () => void; - actions?: FilePreviewActionProps[]; -} - -export function MobileImagePreview({ - previewSrc, - visible, - onClose, - actions, - fileName, -}: FilePreviewProps) { - const [showError, setShowError] = React.useState(false); - const showSheet = Boolean(previewSrc && visible); - - const handleImagesError = () => { - setShowError(true); - }; - - return ( - -
- {showError ? ( -
{i18n('label_image-preview-error')}
- ) : ( - {fileName} - )} - -
- {actions?.map((action) => ( - - ))} -
-
-
- ); -} - -MobileImagePreview.displayName = 'MobileImagePreview';