1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

refactor: move message banner interface to common file (#5076)

https://linear.app/unleash/issue/2-1527/set-up-message-banner-interfaces

Tiny refactor to move the message banner interface to its own file,
since it will be used in multiple places.
This commit is contained in:
Nuno Góis 2023-10-18 10:32:19 +01:00 committed by GitHub
parent 3ac8ab898a
commit ad7149f26f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 18 deletions

View File

@ -10,6 +10,7 @@ import { useNavigate } from 'react-router-dom';
import { MessageBannerDialog } from './MessageBannerDialog/MessageBannerDialog';
import { useState } from 'react';
import ReactMarkdown from 'react-markdown';
import { BannerVariant, IMessageBanner } from 'interfaces/messageBanner';
const StyledBar = styled('aside', {
shouldForwardProp: (prop) => prop !== 'variant' && prop !== 'sticky',
@ -42,20 +43,6 @@ const StyledIcon = styled('div', {
color: theme.palette[variant].main,
}));
type BannerVariant = 'warning' | 'info' | 'error' | 'success';
export interface IMessageBanner {
message: string;
variant?: BannerVariant;
sticky?: boolean;
icon?: string;
link?: string;
linkText?: string;
plausibleEvent?: string;
dialogTitle?: string;
dialog?: string;
}
interface IMessageBannerProps {
messageBanner: IMessageBanner;
}

View File

@ -1,9 +1,7 @@
import {
IMessageBanner,
MessageBanner,
} from 'component/messageBanners/MessageBanner/MessageBanner';
import { MessageBanner } from 'component/messageBanners/MessageBanner/MessageBanner';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useVariant } from 'hooks/useVariant';
import { IMessageBanner } from 'interfaces/messageBanner';
export const ExternalMessageBanners = () => {
const { uiConfig } = useUiConfig();

View File

@ -0,0 +1,19 @@
export type BannerVariant = 'warning' | 'info' | 'error' | 'success';
export interface IMessageBanner {
message: string;
variant?: BannerVariant;
sticky?: boolean;
icon?: string;
link?: string;
linkText?: string;
plausibleEvent?: string;
dialogTitle?: string;
dialog?: string;
}
export interface IInternalMessageBanner extends IMessageBanner {
id: number;
enabled: boolean;
createdAt: string;
}