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:
parent
3ac8ab898a
commit
ad7149f26f
@ -10,6 +10,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { MessageBannerDialog } from './MessageBannerDialog/MessageBannerDialog';
|
import { MessageBannerDialog } from './MessageBannerDialog/MessageBannerDialog';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import { BannerVariant, IMessageBanner } from 'interfaces/messageBanner';
|
||||||
|
|
||||||
const StyledBar = styled('aside', {
|
const StyledBar = styled('aside', {
|
||||||
shouldForwardProp: (prop) => prop !== 'variant' && prop !== 'sticky',
|
shouldForwardProp: (prop) => prop !== 'variant' && prop !== 'sticky',
|
||||||
@ -42,20 +43,6 @@ const StyledIcon = styled('div', {
|
|||||||
color: theme.palette[variant].main,
|
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 {
|
interface IMessageBannerProps {
|
||||||
messageBanner: IMessageBanner;
|
messageBanner: IMessageBanner;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import {
|
import { MessageBanner } from 'component/messageBanners/MessageBanner/MessageBanner';
|
||||||
IMessageBanner,
|
|
||||||
MessageBanner,
|
|
||||||
} from 'component/messageBanners/MessageBanner/MessageBanner';
|
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import { useVariant } from 'hooks/useVariant';
|
import { useVariant } from 'hooks/useVariant';
|
||||||
|
import { IMessageBanner } from 'interfaces/messageBanner';
|
||||||
|
|
||||||
export const ExternalMessageBanners = () => {
|
export const ExternalMessageBanners = () => {
|
||||||
const { uiConfig } = useUiConfig();
|
const { uiConfig } = useUiConfig();
|
||||||
|
19
frontend/src/interfaces/messageBanner.ts
Normal file
19
frontend/src/interfaces/messageBanner.ts
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user