Home / Function/ Message() — react Function Reference

Message() — react Function Reference

Architecture documentation for the Message() function in Message.tsx from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  99a7d412_fd37_4ac7_15d3_d3529f403954["Message()"]
  f9d1133a_53e5_153c_11b1_7ac96107f8d7["Message.tsx"]
  99a7d412_fd37_4ac7_15d3_d3529f403954 -->|defined in| f9d1133a_53e5_153c_11b1_7ac96107f8d7
  style 99a7d412_fd37_4ac7_15d3_d3529f403954 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/apps/playground/components/Message.tsx lines 37–77

  ({id, title, level, source, codeframe}, ref) => {
    const {closeSnackbar} = useSnackbar();
    const isDismissible = source !== MessageSource.Playground;

    return (
      <SnackbarContent
        ref={ref}
        className="flex items-start justify-between gap-3 px-4 py-3 text-sm bg-white border rounded-md shadow w-toast">
        <div className="flex gap-3 w-toast-body">
          {level === MessageLevel.Warning ? (
            <div className="flex items-center justify-center flex-none rounded-md w-7 h-7 bg-amber-100">
              <ExclamationIcon className="w-5 h-5 text-amber-600" />
            </div>
          ) : level === MessageLevel.Error ? (
            <div className="flex items-center justify-center flex-none bg-red-100 rounded-md w-7 h-7">
              <BanIcon className="w-5 h-5 text-red-600" />
            </div>
          ) : (
            <div className="flex items-center justify-center flex-none rounded-md bg-sky-100 w-7 h-7">
              <InformationCircleIcon className="w-5 h-5 text-sky-600" />
            </div>
          )}
          <div className="flex flex-col justify-center gap-1 w-toast-title">
            <p className="w-full">{title}</p>
            {codeframe ? (
              <pre className="overflow-x-auto break-words whitespace-pre-wrap">
                <code className="text-xs">{codeframe}</code>
              </pre>
            ) : null}
          </div>
        </div>
        {isDismissible ? (
          <button
            className="flex items-center justify-center flex-none transition-colors duration-150 ease-in rounded-md justify-self-end group w-7 h-7 hover:bg-gray-200"
            onClick={() => closeSnackbar(id)}>
            <XIcon className="w-5 h-5 fill-gray-500 group-hover:fill-gray-800" />
          </button>
        ) : null}
      </SnackbarContent>
    );
  },

Domain

Subdomains

Frequently Asked Questions

What does Message() do?
Message() is a function in the react codebase, defined in compiler/apps/playground/components/Message.tsx.
Where is Message() defined?
Message() is defined in compiler/apps/playground/components/Message.tsx at line 37.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free