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.
- package/dist/cjs/index.js +24 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ErrorBox.d.ts +4 -0
- package/dist/esm/index.js +24 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ErrorBox.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +9 -0
- package/src/components/ErrorBox.tsx +10 -2
|
@@ -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
package/package.json
CHANGED
|
@@ -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=
|
|
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={
|
|
102
|
+
icon={icon}
|
|
95
103
|
className="me-2"
|
|
96
104
|
/>
|
|
97
105
|
{title}
|