diff --git a/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx b/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx index 27a125b..61e7977 100644 --- a/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx +++ b/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx @@ -11,7 +11,7 @@ import { eventBroker, } from '@gravity-ui/uikit'; -import {AsideHeader, AsideHeaderTopAlertProps, FooterItem} from '../..'; +import {AsideHeader, FooterItem, TopAlertProps} from '../..'; import {ASIDE_HEADER_ICON_SIZE} from '../../constants'; import {MenuItem, OpenModalSubscriber} from '../../types'; import {cn} from '../../utils/cn'; @@ -39,7 +39,7 @@ enum Panel { interface AsideHeaderShowcaseProps { multipleTooltip?: boolean; initialCompact?: boolean; - topAlert?: AsideHeaderTopAlertProps; + topAlert?: TopAlertProps; customBackground?: React.ReactNode; customBackgroundClassName?: string; headerDecoration?: boolean; diff --git a/src/components/AsideHeader/components/PageLayout/PageLayout.tsx b/src/components/AsideHeader/components/PageLayout/PageLayout.tsx index a845a5d..9932223 100644 --- a/src/components/AsideHeader/components/PageLayout/PageLayout.tsx +++ b/src/components/AsideHeader/components/PageLayout/PageLayout.tsx @@ -28,7 +28,7 @@ const Layout = ({compact, className, children, topAlert}: PageLayoutProps) => { > {topAlert && ( - + )}
{children}
diff --git a/src/components/AsideHeader/types.tsx b/src/components/AsideHeader/types.tsx index fb1c5d0..a0f2310 100644 --- a/src/components/AsideHeader/types.tsx +++ b/src/components/AsideHeader/types.tsx @@ -2,20 +2,14 @@ import {QAProps} from '@gravity-ui/uikit'; import {RenderContentType} from '../Content'; import {DrawerItemProps} from '../Drawer/Drawer'; -import { - AsideHeaderTopAlertProps, - LogoProps, - MenuItem, - OpenModalSubscriber, - SubheaderMenuItem, -} from '../types'; +import {LogoProps, MenuItem, OpenModalSubscriber, SubheaderMenuItem, TopAlertProps} from '../types'; import {AsideHeaderContextType} from './AsideHeaderContext'; export interface LayoutProps { compact: boolean; className?: string; - topAlert?: AsideHeaderTopAlertProps; + topAlert?: TopAlertProps; } export interface AsideHeaderGeneralProps extends QAProps { @@ -25,7 +19,7 @@ export interface AsideHeaderGeneralProps extends QAProps { collapseTitle?: string; expandTitle?: string; menuMoreTitle?: string; - topAlert?: AsideHeaderTopAlertProps; + topAlert?: TopAlertProps; customBackground?: React.ReactNode; customBackgroundClassName?: string; hideCollapseButton?: boolean; diff --git a/src/components/MobileHeader/MobileHeader.tsx b/src/components/MobileHeader/MobileHeader.tsx index 1fc6047..03d319b 100644 --- a/src/components/MobileHeader/MobileHeader.tsx +++ b/src/components/MobileHeader/MobileHeader.tsx @@ -270,7 +270,7 @@ export const MobileHeader = React.forwardRef(
{topAlert && ( - + )}
diff --git a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-chromium-linux.png b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-chromium-linux.png index 320cb5f..5987177 100644 Binary files a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-chromium-linux.png and b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-chromium-linux.png differ diff --git a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-webkit-linux.png b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-webkit-linux.png index 0ea3d30..ffa73d8 100644 Binary files a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-webkit-linux.png and b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-dark-webkit-linux.png differ diff --git a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-chromium-linux.png b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-chromium-linux.png index 06ce887..b8fe4c6 100644 Binary files a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-chromium-linux.png and b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-chromium-linux.png differ diff --git a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-webkit-linux.png b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-webkit-linux.png index ad800dc..5bf2888 100644 Binary files a/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-webkit-linux.png and b/src/components/MobileHeader/__snapshots__/MobileHeader.visual.test.tsx-snapshots/MobileHeader-render-story-Showcase-light-webkit-linux.png differ diff --git a/src/components/TopAlert/TopAlert.tsx b/src/components/TopAlert/TopAlert.tsx index 130e85e..7538adf 100644 --- a/src/components/TopAlert/TopAlert.tsx +++ b/src/components/TopAlert/TopAlert.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import {Alert} from '@gravity-ui/uikit'; +import {Alert, Text} from '@gravity-ui/uikit'; import {TopAlertProps} from '../types'; import {block} from '../utils/cn'; @@ -14,10 +14,10 @@ const b = block('top-alert'); type Props = { alert?: TopAlertProps; className?: string; - withBottomBorder?: boolean; + mobileView?: boolean; }; -export const TopAlert = ({alert, className, withBottomBorder = false}: Props) => { +export const TopAlert = ({alert, className, mobileView = false}: Props) => { const {alertRef, updateTopSize} = useTopAlertHeight({alert}); const [opened, setOpened] = React.useState(true); @@ -40,7 +40,7 @@ export const TopAlert = ({alert, className, withBottomBorder = false}: Props) => return (
{opened && ( view={alert.view} icon={alert.icon} title={alert.title} - message={alert.message} + message={ + mobileView ? ( + + {alert.message} + + ) : ( + alert.message + ) + } actions={alert.actions} onClose={alert.closable ? handleClose : undefined} /> diff --git a/src/components/types.ts b/src/components/types.ts index 954e403..028187f 100644 --- a/src/components/types.ts +++ b/src/components/types.ts @@ -75,6 +75,7 @@ export interface LogoProps { } export interface TopAlertProps { + align?: AlertProps['align']; message: AlertProps['message']; title?: AlertProps['title']; icon?: AlertProps['icon'];