Skip to content

Commit

Permalink
fix(FilePreview): fix visual of actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mournfulCoroner committed Jan 23, 2025
1 parent 3f580e1 commit dfe9c58
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/components/FilePreview/FilePreview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $smallRoundedButtonSize: 24px;
--_-box-shadow: none;
--_-border-radius: 4px;
--_-color-base-background: transparent;
--_-action-button-size: 24px;

position: relative;

Expand Down Expand Up @@ -145,4 +146,15 @@ $smallRoundedButtonSize: 24px;
height: 100%;
width: 100%;
}

&__action-button {
height: var(--_-action-button-size);
width: var(--_-action-button-size);
display: flex;
align-items: center;
}

&__action-icon-wrapper {
display: flex;
}
}
7 changes: 6 additions & 1 deletion src/components/FilePreview/FilePreviewAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import type * as React from 'react';
import {ActionTooltip} from '../ActionTooltip';
import type {ActionTooltipProps} from '../ActionTooltip';
import {Button} from '../Button';
import {block} from '../utils/cn';

import './FilePreview.scss';

const cn = block('file-preview');
export interface FilePreviewActionProps {
id?: string;
icon: React.ReactNode;
Expand Down Expand Up @@ -37,9 +41,10 @@ export function FilePreviewAction({
href={href}
disabled={disabled}
size="s"
className={cn('action-button')}
extraProps={{'aria-label': title, 'aria-describedby': id, ...extraProps}}
>
{icon}
<div className={cn('action-icon-wrapper')}>{icon}</div>
</Button>
</ActionTooltip>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {CircleExclamation, Link, Xmark} from '@gravity-ui/icons';
import {action} from '@storybook/addon-actions';
import type {Meta, StoryFn} from '@storybook/react';

import {Icon} from '../../Icon';
import {Flex} from '../../layout';
import type {FilePreviewProps} from '../FilePreview';
import {FilePreview} from '../FilePreview';
Expand Down Expand Up @@ -71,7 +72,7 @@ const CollageTemplate: StoryFn<FilePreviewProps> = () => {
onClick: () => action('onLink'),
},
{
icon: <Xmark width={14} height={14} />,
icon: <Icon data={Xmark} width={14} height={14} />,
title: 'delete a file',
onClick: () => action('onClose'),
},
Expand Down

0 comments on commit dfe9c58

Please sign in to comment.