@autobusal/common 1.0.7 → 1.1.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.
@@ -0,0 +1,37 @@
1
+ import { IoAlertSharp, IoBusSharp, IoChatboxOutline, IoCheckmarkOutline, IoCloseSharp, IoWarningOutline } from 'react-icons/io5';
2
+ import { ICONS } from './utilities';
3
+
4
+ interface Props {
5
+ type?: string
6
+ size?: number
7
+ }
8
+
9
+ const Icon = ({ type, size }: Props): (JSX.Element | undefined) => {
10
+ if (type === undefined || !ICONS.includes(type)) {
11
+ return undefined;
12
+ }
13
+
14
+ switch (type) {
15
+ case 'warning':
16
+ return <IoWarningOutline size={ size } />;
17
+
18
+ case 'error':
19
+ return <IoCloseSharp size={ size } />;
20
+
21
+ case 'success':
22
+ return <IoCheckmarkOutline size={ size } />;
23
+
24
+ case 'alert':
25
+ return <IoAlertSharp size={ size } />;
26
+
27
+ case 'bus':
28
+ return <IoBusSharp size={ size } />;
29
+
30
+ case 'message':
31
+ return <IoChatboxOutline size={ size } />;
32
+ }
33
+
34
+ return <></>;
35
+ };
36
+
37
+ export default Icon;
@@ -0,0 +1,16 @@
1
+ export const ICONS = [
2
+ 'warning', 'error', 'success', 'alert', 'bus', 'message'
3
+ ];
4
+
5
+ export const getBackgroundColor = (type?: string): (string | undefined) => {
6
+ switch (type) {
7
+ case 'warning':
8
+ return '#FF9C5A';
9
+
10
+ case 'error':
11
+ return '#FF6B5A';
12
+
13
+ case 'success':
14
+ return '#6CF96B';
15
+ }
16
+ };
package/index.ts CHANGED
@@ -17,6 +17,7 @@ import { General, Inline, Box, BoxMiddle, GeneralFull } from './Loading/Loading'
17
17
  import IpLogs from './IpLogs/IpLogs';
18
18
  import Meta from './Meta';
19
19
  import Modal from './Modal/Modal';
20
+ import NotificationIcon from './Notifications/Icon';
20
21
  import Pagination from './Pagination/Pagination';
21
22
  import Paragraph from './Loading/Paragraph';
22
23
  import Passengers from './Passengers/Passengers';
@@ -53,6 +54,7 @@ export {
53
54
  IpLogs,
54
55
  Meta,
55
56
  Modal,
57
+ NotificationIcon,
56
58
  Pagination,
57
59
  Paragraph,
58
60
  Passengers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }