@performant-software/semantic-components 1.0.22 → 1.0.23-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,14 +6,37 @@ import _ from 'underscore';
6
6
  import './Toaster.css';
7
7
 
8
8
  type Props = {
9
+ /**
10
+ * A child element that will be displayed in the toaster pane.
11
+ * It can be a simple as a Text string or any child component.
12
+ */
9
13
  children: Array<Element<any>>,
14
+ /**
15
+ * An optional function to be called when the toaster pane closes.
16
+ */
10
17
  onDismiss?: () => void,
18
+ /**
19
+ * Time in milliseconds that the toaster should be displayed to the
20
+ * user.
21
+ */
11
22
  timeout: number,
23
+ /**
24
+ * The type of Toaster that should be displayed. The Toaster component supports:
25
+ * * "info" - A yellow Toaster pane used to display useful but non-critical information
26
+ * * "positive" - A green toaster pane. This should be used for postive user feedback
27
+ * * "negative" - A red toaster pane. This should be used for negative user feedback and errors
28
+ * * "warning"
29
+ */
12
30
  type: string
13
31
  };
14
32
 
15
33
  const TRANSITION_DURATION = 700;
16
34
 
35
+ /**
36
+ *
37
+ * This is a simple messaging pane that drops from the top of
38
+ * the page and displays that child elements
39
+ */
17
40
  const Toaster = (props: Props) => {
18
41
  const [visible, setVisible] = useState(true);
19
42
 
@@ -49,7 +72,7 @@ const Toaster = (props: Props) => {
49
72
  negative={props.type === Toaster.MessageTypes.negative}
50
73
  onDismiss={() => setVisible(false)}
51
74
  positive={props.type === Toaster.MessageTypes.positive}
52
- warning={props.type === Toaster.MessageTypes.negative}
75
+ warning={props.type === Toaster.MessageTypes.warning}
53
76
  >
54
77
  { props.children }
55
78
  </Message>