Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FilePreview): add component #1880

Merged
merged 5 commits into from
Nov 11, 2024
Merged

feat(FilePreview): add component #1880

merged 5 commits into from
Nov 11, 2024

Conversation

KirillDyachkovskiy
Copy link
Contributor

@KirillDyachkovskiy KirillDyachkovskiy commented Sep 28, 2024

Component moved from @gravity-ui/components

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

height: 64px;
width: 96px;

&-img {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like separated block &__image-img (with confusing naming). Could you move it out from the &__image block?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can describe FileType and FILE_TYPES in a more flexible way:

export const FILE_TYPES = [
    'default',
    'image',
    'video',
    'code',
    'archive',
    'music',
    'text',
    'pdf',
    'table',
] as const;

export type FileType = (typeof FILE_TYPES)[number];


const handleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {
if (mobile && isPreviewString && !onClick) {
setShowPreviewSheet(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why onClick does not triggered here? It looks inconsistent


export interface FilePreviewActionProps {
id?: string;
icon: IconData;
Copy link
Contributor

@korvin89 korvin89 Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it cannot be just a react node?

}: FilePreviewActionProps) {
return (
<ActionTooltip id={id} title={title} {...tooltipExtraProps}>
<Button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add aria-describedby to the Button and id to the tooltip


### Properties

| Property | Type | Required | Default | Description |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this order of columns for consistency purposes

@@ -0,0 +1,4 @@
export {FilePreview} from './FilePreview';
export type {FilePreviewProps} from './FilePreview';
export {getFileType} from './utils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need it as a public interface?

@vvtimofeev
Copy link
Contributor

@korvin89 please come back to this PR, Kirill added 4 commits after the most recent comments, i think he implemented your suggestions.

@amje amje merged commit b5de671 into main Nov 11, 2024
6 checks passed
@amje amje deleted the uikit-file-preview branch November 11, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants