2021-03-18 18:06:13 -07:00
|
|
|
import { Icon, Link, Stack, Text } from "office-ui-fabric-react";
|
2021-04-30 10:23:34 -07:00
|
|
|
import React from "react";
|
2021-03-18 18:06:13 -07:00
|
|
|
|
|
|
|
export interface PanelInfoErrorProps {
|
|
|
|
message: string;
|
|
|
|
messageType: string;
|
|
|
|
showErrorDetails: boolean;
|
|
|
|
link?: string;
|
|
|
|
linkText?: string;
|
|
|
|
openNotificationConsole?: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProps> = (
|
|
|
|
props: PanelInfoErrorProps
|
|
|
|
): JSX.Element => {
|
|
|
|
let icon: JSX.Element;
|
|
|
|
if (props.messageType === "error") {
|
|
|
|
icon = <Icon iconName="StatusErrorFull" className="panelErrorIcon" />;
|
|
|
|
} else if (props.messageType === "warning") {
|
|
|
|
icon = <Icon iconName="WarningSolid" className="panelWarningIcon" />;
|
|
|
|
} else if (props.messageType === "info") {
|
|
|
|
icon = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-04-30 10:23:34 -07:00
|
|
|
<Stack className="panelInfoErrorContainer" horizontal verticalAlign="center">
|
2021-03-18 18:06:13 -07:00
|
|
|
{icon}
|
|
|
|
<span className="panelWarningErrorDetailsLinkContainer">
|
|
|
|
<Text className="panelWarningErrorMessage" variant="small">
|
|
|
|
{props.message}{" "}
|
|
|
|
{props.link && props.linkText && (
|
|
|
|
<Link target="_blank" href={props.link}>
|
|
|
|
{props.linkText}
|
|
|
|
</Link>
|
|
|
|
)}
|
|
|
|
</Text>
|
|
|
|
{props.showErrorDetails && (
|
|
|
|
<a className="paneErrorLink" role="link" onClick={props.openNotificationConsole}>
|
|
|
|
More details
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
</Stack>
|
|
|
|
);
|
|
|
|
};
|