File tree Expand file tree Collapse file tree
src/typescript/api/src/api/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ export * from "./action-pannel.js";
55export * from "./actions.js" ;
66export * from "./form.js" ;
77export * from "./menu-bar.js" ;
8+ export * from "./message.js" ;
Original file line number Diff line number Diff line change 1+ import type { ReactNode } from "react" ;
2+ import { Color } from "../color" ;
3+ import { Icon } from "../icon" ;
4+ import type { ImageLike } from "../image" ;
5+ import { List } from "./list" ;
6+
7+ /**
8+ * A full-page message for states that block the command's regular content.
9+ *
10+ * @category UI Components
11+ * @public
12+ */
13+ export namespace Message {
14+ export type Status = "info" | "error" ;
15+
16+ export type Props = {
17+ title : string ;
18+ description ?: string ;
19+ navigationTitle ?: string ;
20+ status ?: Status ;
21+ icon ?: ImageLike ;
22+ actions ?: ReactNode ;
23+ } ;
24+ }
25+
26+ export const Message : React . FC < Message . Props > = ( {
27+ actions,
28+ icon,
29+ status = "info" ,
30+ navigationTitle,
31+ ...emptyViewProps
32+ } ) => {
33+ const defaultIcon : ImageLike = {
34+ source : status === "error" ? Icon . XMarkCircle : Icon . Info01 ,
35+ tintColor : status === "error" ? Color . Red : Color . PrimaryText ,
36+ } ;
37+
38+ return (
39+ < List navigationTitle = { navigationTitle } filtering = { false } >
40+ < List . EmptyView
41+ { ...emptyViewProps }
42+ icon = { icon ?? defaultIcon }
43+ actions = { actions }
44+ />
45+ </ List >
46+ ) ;
47+ } ;
You can’t perform that action at this time.
0 commit comments