cosmos-explorer/src/Explorer/Panes/PanelInfoErrorComponent.tsx

59 lines
1.9 KiB
TypeScript
Raw Normal View History

import { Icon, Link, Stack, Text } from "@fluentui/react";
import React from "react";
import { useNotificationConsole } from "../../hooks/useNotificationConsole";
export interface PanelInfoErrorProps {
message: string;
messageType: string;
showErrorDetails: boolean;
link?: string;
linkText?: string;
formError?: boolean;
}
export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProps> = ({
message,
messageType,
showErrorDetails,
link,
linkText,
}: PanelInfoErrorProps): JSX.Element => {
const expandConsole = useNotificationConsole((state) => state.expandConsole);
let icon: JSX.Element = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" aria-label="Infomation" />;
if (messageType === "error") {
icon = <Icon iconName="StatusErrorFull" className="panelErrorIcon" aria-label="error" />;
} else if (messageType === "warning") {
icon = <Icon iconName="WarningSolid" className="panelWarningIcon" aria-label="warning" />;
} else if (messageType === "info") {
icon = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" aria-label="Infomation" />;
}
return (
<Stack className="panelInfoErrorContainer" horizontal verticalAlign="center">
{icon}
<span className="panelWarningErrorDetailsLinkContainer">
<Text
role="alert"
aria-live="assertive"
aria-label={message}
className="panelWarningErrorMessage"
variant="small"
>
{message}
{link && linkText && (
<Link target="_blank" href={link}>
{" " + linkText}
</Link>
)}
</Text>
{showErrorDetails && (
Defect1711833 (#1370) * keyboard navigation for defects 1722611,1722618 * Fixes for keyboard navigation of add new clause,edit,remove property,insert filter line, remove filter line * Revert "keyboard navigation for defects 1722611,1722618" This reverts commit 9383609a2205b2c407ceb41fc01009eb0d816998. * html,css changes corected after reversion * Revert "html,css changes corected after reversion" This reverts commit 712e0e0c1e9f46da07b65d34140059c477b3248a. * committing changes for the keyboard navigation * format fixes * changes to addcollectionpanel.test.tsx snp file * changes in infotooltip for defct * Revert "changes in infotooltip for defct" This reverts commit ca9833e20860e66b8a46993c23e8b76f76cb645f. * commit for tooltip in defect 1704149 * Revert "commit for tooltip in defect 1704149" This reverts commit 44766e82134d3591ff43c5434218f9c703414b6c. * InfoTooltip changes * update snapshot * defect1722595 Bug 1722595: [Screen readers Azure Cosmos DB Scale& Settings: Screen reader (NVDA) is not announcing status message which is displayed on the screen after radio button is selected under scale tab. * more options in delete entity dialog is not accessible through keyboard * Revert "more options in delete entity dialog is not accessible through keyboard" This reverts commit 23a05ef18e7cce21fc1aa3aef1c1cbcca257d303. * more options in delete entity dialog is not accessible throgh keyboard * remove native html with role='alert' for messagebar * role added for messagebar fluentui component
2023-01-10 21:32:29 +05:30
<a className="paneErrorLink" role="link" onClick={expandConsole} tabIndex={0} onKeyPress={expandConsole}>
More details
</a>
)}
</span>
</Stack>
);
};