From ba3f0db04a91f699bfe03be344453b991d0efb6d Mon Sep 17 00:00:00 2001 From: Anton Vikulov Date: Fri, 22 Dec 2023 16:33:17 +0500 Subject: [PATCH] fix(ChangelogDialog): error view --- .../ErrorContainer/ErrorContainer.scss | 14 ------- .../ErrorContainer/ErrorContainer.tsx | 40 +++++++------------ 2 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.scss diff --git a/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.scss b/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.scss deleted file mode 100644 index cd71282c..00000000 --- a/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.scss +++ /dev/null @@ -1,14 +0,0 @@ -@use '@gravity-ui/uikit/styles/mixins'; -@use '../../../variables'; - -$block: '.#{variables.$ns}changelog-dialog-error-container'; - -#{$block} { - &__error-image-container { - text-align: center; - } - - &__error-image { - color: var(--g-color-text-warning); - } -} diff --git a/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.tsx b/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.tsx index 9a3f79df..d970b604 100644 --- a/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.tsx +++ b/src/components/ChangelogDialog/components/ErrorContainer/ErrorContainer.tsx @@ -1,42 +1,32 @@ -import React, {FC, useMemo} from 'react'; +import React from 'react'; -import {TriangleExclamation} from '@gravity-ui/icons'; -import {Icon} from '@gravity-ui/uikit'; +import {Alert} from '@gravity-ui/uikit'; -import {PlaceholderContainer} from '../../../PlaceholderContainer'; -import {block} from '../../../utils/cn'; import i18n from '../../i18n'; -import './ErrorContainer.scss'; - -const b = block('changelog-dialog-error-container'); - interface ErrorContainerProps { onRetryClick?: () => void; error?: boolean | {title?: string; description?: string}; } -export const ErrorContainer: FC = ({onRetryClick, error}) => { - const {title, description} = useMemo(() => { +export function ErrorContainer({onRetryClick, error}: ErrorContainerProps) { + const {title, description} = React.useMemo(() => { return error && typeof error === 'object' ? error : {}; }, [error]); return ( - - - - } - action={ - onRetryClick && { - text: i18n('button_retry'), - handler: onRetryClick, - } + message={description} + theme={'danger'} + actions={ + onRetryClick && [ + { + text: i18n('button_retry'), + handler: onRetryClick, + }, + ] } /> ); -}; +}