dce-reactkit 3.6.4 → 3.6.5

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.
@@ -3,10 +3,14 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
+ import { IconProp } from '@fortawesome/fontawesome-svg-core';
7
+ import Variant from '../types/Variant';
6
8
  type Props = {
7
9
  error: any;
8
10
  title?: string;
9
11
  onClose?: () => void;
12
+ variant?: Variant;
13
+ icon?: IconProp;
10
14
  };
11
15
  declare const ErrorBox: React.FC<Props>;
12
16
  export default ErrorBox;
package/dist/index.d.ts CHANGED
@@ -92,6 +92,8 @@ type Props$j = {
92
92
  error: any;
93
93
  title?: string;
94
94
  onClose?: () => void;
95
+ variant?: Variant;
96
+ icon?: IconProp;
95
97
  };
96
98
  declare const ErrorBox: React.FC<Props$j>;
97
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.6.4",
3
+ "version": "3.6.5",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -7,6 +7,9 @@
7
7
  // Import React
8
8
  import React, { useState } from 'react';
9
9
 
10
+ // Import FontAwesome
11
+ import { faHourglassEnd } from '@fortawesome/free-solid-svg-icons';
12
+
10
13
  // Import shared components
11
14
  import ErrorBox from './ErrorBox';
12
15
 
@@ -593,6 +596,12 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
593
596
  : fatalErrorTitle
594
597
  )}
595
598
  error={error}
599
+ variant={(
600
+ isDarkModeOn()
601
+ ? Variant.Light
602
+ : Variant.Secondary
603
+ )}
604
+ icon={faHourglassEnd}
596
605
  />
597
606
  </div>
598
607
  );
@@ -9,9 +9,11 @@ import React from 'react';
9
9
  // Import FontAwesome Icons
10
10
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
11
  import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
12
+ import { IconProp } from '@fortawesome/fontawesome-svg-core';
12
13
 
13
14
  // Import shared types
14
15
  import ReactKitErrorCode from '../types/ReactKitErrorCode';
16
+ import Variant from '../types/Variant';
15
17
 
16
18
  /*------------------------------------------------------------------------*/
17
19
  /* -------------------------------- Types ------------------------------- */
@@ -24,6 +26,10 @@ type Props = {
24
26
  title?: string,
25
27
  // Handler for close,
26
28
  onClose?: () => void,
29
+ // Variant for notice (defaults to danger)
30
+ variant?: Variant,
31
+ // Custom icon before error message (defaults to exclamation triangle)
32
+ icon?: IconProp,
27
33
  };
28
34
 
29
35
  /*------------------------------------------------------------------------*/
@@ -41,6 +47,8 @@ const ErrorBox: React.FC<Props> = (props) => {
41
47
  error,
42
48
  title = 'An Error Occurred',
43
49
  onClose,
50
+ variant = Variant.Danger,
51
+ icon = faExclamationTriangle,
44
52
  } = props;
45
53
 
46
54
  /*------------------------------------------------------------------------*/
@@ -83,7 +91,7 @@ const ErrorBox: React.FC<Props> = (props) => {
83
91
  // Main UI
84
92
  return (
85
93
  <div
86
- className="alert alert-danger text-center"
94
+ className={`alert alert-${variant} text-center`}
87
95
  style={{
88
96
  maxWidth: '40rem',
89
97
  margin: 'auto',
@@ -91,7 +99,7 @@ const ErrorBox: React.FC<Props> = (props) => {
91
99
  >
92
100
  <h4 className="mb-1">
93
101
  <FontAwesomeIcon
94
- icon={faExclamationTriangle}
102
+ icon={icon}
95
103
  className="me-2"
96
104
  />
97
105
  {title}