trufflesuite/truffle

View on GitHub
packages/dashboard/src/components/composed/Notice/index.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import { Center } from "@mantine/core";
import Loading from "src/components/composed/Notice/content/Loading";
import Connect from "src/components/composed/Notice/content/Connect";
import ConfirmChain from "src/components/composed/Notice/content/ConfirmChain";
import type { NoticeContent } from "src/components/composed/Notice/content/types";

type NoticeProps = {
  contentType: NoticeContent;
};

function Notice({ contentType }: NoticeProps): JSX.Element {
  let content: JSX.Element;
  switch (contentType) {
    case "LOADING":
      content = <Loading />;
      break;
    case "CONNECT":
      content = <Connect />;
      break;
    case "CONFIRM_CHAIN":
      content = <ConfirmChain />;
      break;
    default:
      content = <div>Undefined notice</div>;
      break;
  }

  return (
    <Center pb="xl" sx={{ height: "100%" }}>
      {content}
    </Center>
  );
}

export default Notice;