Skip to content

Commit

Permalink
refactor: move message banner interface to common file (#5076)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nunogois committed Oct 18, 2023
1 parent 3ac8ab8 commit ad7149f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
}
Expand Down
@@ -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();
Expand Down
19 changes: 19 additions & 0 deletions frontend/src/interfaces/messageBanner.ts
@@ -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;
}

0 comments on commit ad7149f

Please sign in to comment.