Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move message banner interface to common file #5076

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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