MCPcopy Create free account
hub / github.com/dfinity/cancan / LoadingIndicator

Function LoadingIndicator

src/components/LoadingIndicator.tsx:11–37  ·  view source on GitHub ↗
({
  loadingMessage = "Loading...",
  completedMessage,
  isLoading = true,
}: LoadingIndicatorProps)

Source from the content-addressed store, hash-verified

9}
10
11export function LoadingIndicator({
12 loadingMessage = "Loading...",
13 completedMessage,
14 isLoading = true,
15}: LoadingIndicatorProps) {
16 // Adding the `.completed-message` class will delay the fade-out for 1s to
17 // allow the user to see the updated message before it disappears.
18 const showCompletedMessage = completedMessage ? "completed-message " : "";
19 const timeout = completedMessage ? 2000 : 1000;
20
21 return (
22 <CSSTransition
23 in={isLoading}
24 timeout={timeout}
25 classNames="LoadingContainer"
26 unmountOnExit
27 >
28 <div className={`${showCompletedMessage}LoadingContainer`}>
29 <div className="LoadingContainerContent">
30 <h2>
31 {isLoading ? loadingMessage : completedMessage ?? loadingMessage}
32 </h2>
33 </div>
34 </div>
35 </CSSTransition>
36 );
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected