Skip to content

Commit

Permalink
feat(Notifications): add qa prop (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: kirill <[email protected]>
  • Loading branch information
KirillDyachkovskiy and kirill authored Sep 11, 2024
1 parent 262cab8 commit 786595a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/components/FilePreview/FilePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import {
TextAlignLeft as TextIcon,
Filmstrip as VideoIcon,
} from '@gravity-ui/icons';
import {Icon, IconData, Text, useActionHandlers, useMobile, useUniqId} from '@gravity-ui/uikit';
import {
Icon,
IconData,
QAProps,
Text,
useActionHandlers,
useMobile,
useUniqId,
} from '@gravity-ui/uikit';

import {block} from '../utils/cn';

Expand All @@ -36,9 +44,8 @@ const FILE_ICON: Record<FileType, IconData> = {
table: TableIcon,
};

export interface FilePreviewProps {
export interface FilePreviewProps extends QAProps {
className?: string;
qa?: string;

file: File;
imageSrc?: string;
Expand Down
1 change: 1 addition & 0 deletions src/components/Notification/NotificationAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const NotificationAction = React.memo(function NotificationAction({action

const button = (
<Button
qa={action.qa}
className={b('action', {icon: Boolean(action.icon)})}
view={action.view ?? 'flat'}
href={action.href}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notification/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ButtonProps, IconData} from '@gravity-ui/uikit';
import {ButtonProps, IconData, QAProps} from '@gravity-ui/uikit';

export type NotificationTheme = 'success' | 'info' | 'warning' | 'danger';

Expand Down Expand Up @@ -46,4 +46,4 @@ export type NotificationActionProps = {
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
href?: string;
target?: '_blank';
};
} & QAProps;
2 changes: 1 addition & 1 deletion src/components/Notifications/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Notifications = React.memo(function Notifications(props: Notificati
}

return (
<div className={b()}>
<div className={b()} data-qa={props.qa}>
<div className={b('head')}>
<div className={b('head-title')}>{props.title || i18n('title')}</div>
{<div className={b('actions')}>{props.actions}</div>}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Notifications/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {QAProps} from '@gravity-ui/uikit';

import {NotificationActionProps, NotificationProps} from '../Notification/definitions';

export type NotificationsActionProps = NotificationActionProps;
Expand All @@ -21,4 +23,4 @@ export type NotificationsProps = {
emptyImage?: React.ReactNode;

swipeThreshold?: number;
};
} & QAProps;

0 comments on commit 786595a

Please sign in to comment.