namirasoft-site-react 1.3.353 → 1.3.354
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/components/NSBarNotification.d.ts +3 -0
- package/dist/components/NSBarNotification.js +8 -2
- package/dist/components/NSBarNotification.js.map +1 -1
- package/dist/components/NSLayout.js +1 -13
- package/dist/components/NSLayout.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NSBarNotification.tsx +31 -16
- package/src/components/NSLayout.tsx +5 -28
|
@@ -5,6 +5,9 @@ export interface INSBarNotificationProps extends IBaseComponentProps {
|
|
|
5
5
|
color: NSBarNotificationColor;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
}
|
|
8
|
+
export interface INSBarNotificationState {
|
|
9
|
+
show: boolean;
|
|
10
|
+
}
|
|
8
11
|
export declare enum NSBarNotificationColor {
|
|
9
12
|
GRAY = "GRAY",
|
|
10
13
|
BLUE = "BLUE",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import Styles from "./NSBarNotification.module.css";
|
|
3
|
+
import { useState } from "react";
|
|
3
4
|
export var NSBarNotificationColor;
|
|
4
5
|
(function (NSBarNotificationColor) {
|
|
5
6
|
NSBarNotificationColor["GRAY"] = "GRAY";
|
|
@@ -16,6 +17,7 @@ export var NotificationType;
|
|
|
16
17
|
NotificationType["Error"] = "Error";
|
|
17
18
|
})(NotificationType || (NotificationType = {}));
|
|
18
19
|
export function NSBarNotification(props) {
|
|
20
|
+
const [state, setState] = useState({ show: true });
|
|
19
21
|
let className = Styles["ns_" + props.color.toString().toLowerCase()];
|
|
20
22
|
let type = props.type;
|
|
21
23
|
let src = "";
|
|
@@ -32,6 +34,10 @@ export function NSBarNotification(props) {
|
|
|
32
34
|
case "Information":
|
|
33
35
|
src = "https://static.namirasoft.com/image/concept/close/info.svg";
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
if (state.show)
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
setState({ show: false });
|
|
40
|
+
}, 5000);
|
|
41
|
+
return (_jsx(_Fragment, { children: state.show && (_jsxs("div", { id: props.id, className: `${Styles.ns_messenger} ${className}`, style: props.style, children: [_jsx("p", { className: `mb-0 ns-font-16-normal`, children: props.text }), _jsx("img", { className: Styles.ns_exit_icon, src: src, alt: "exit", width: 32, height: 32, onClick: props.onClose })] })) }));
|
|
36
42
|
}
|
|
37
43
|
//# sourceMappingURL=NSBarNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSBarNotification.js","sourceRoot":"","sources":["../../src/components/NSBarNotification.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"NSBarNotification.js","sourceRoot":"","sources":["../../src/components/NSBarNotification.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAahC,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAE9B,uCAAa,CAAA;IACb,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;AACf,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAED,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAExB,+CAA2B,CAAA;IAC3B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,mCAAe,CAAA;AACnB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B;AAED,MAAM,UAAU,iBAAiB,CAAC,KAA8B;IAE5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA0B,EAAE,IAAI,EAAE,IAAI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3
2
|
import Styles from './NSLayout.module.css';
|
|
4
3
|
import { NSHeader } from './NSHeader';
|
|
5
4
|
import { NSFooter } from './NSFooter';
|
|
@@ -10,17 +9,6 @@ import { NSBarTitle } from './NSBarTitle';
|
|
|
10
9
|
import { NSSpace, NSSpaceSizeType } from './NSSpace';
|
|
11
10
|
export function NSLayout(props) {
|
|
12
11
|
var _a;
|
|
13
|
-
const [showNotifications, setShowNotifications] = useState(Array(props.notifications.length).fill(true));
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const timers = props.notifications.map((_, index) => setTimeout(() => {
|
|
16
|
-
setShowNotifications(prev => {
|
|
17
|
-
const newVisibility = [...prev];
|
|
18
|
-
newVisibility[index] = false;
|
|
19
|
-
return newVisibility;
|
|
20
|
-
});
|
|
21
|
-
}, 5000));
|
|
22
|
-
return () => timers.forEach(timer => clearTimeout(timer));
|
|
23
|
-
}, [props.notifications]);
|
|
24
12
|
function isValidAction(action) {
|
|
25
13
|
if (action)
|
|
26
14
|
if (action.title || action.description || Object.keys(action.menus).length > 0)
|
|
@@ -36,7 +24,7 @@ export function NSLayout(props) {
|
|
|
36
24
|
background: props.background,
|
|
37
25
|
backgroundSize: "cover",
|
|
38
26
|
backgroundAttachment: "fixed"
|
|
39
|
-
}, children: [_jsx(NSHeader, { scope: props.scope, name: "Header", logo: props.logo, header: props.header, isLoggedIn: props.isLoggedIn }), props.notifications.map(
|
|
27
|
+
}, children: [_jsx(NSHeader, { scope: props.scope, name: "Header", logo: props.logo, header: props.header, isLoggedIn: props.isLoggedIn }), props.notifications.map(props => _jsx(NSBarNotification, Object.assign({}, props))), isValidAction(props.action) && _jsx(NSBarAction, Object.assign({}, props.action)), props.banner && _jsx(NSBarHeroBanner, Object.assign({}, props.banner)), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), props.title &&
|
|
40
28
|
_jsxs(_Fragment, { children: [_jsx(NSBarTitle, Object.assign({}, props.title)), _jsx(NSSpace, { size: NSSpaceSizeType.MEDUIM })] }), _jsx("main", { className: `d-flex flex-column text-white ${Styles.ns_layout_main}`, children: props.children }), _jsx(NSSpace, { size: NSSpaceSizeType.MEDUIM }), _jsx(NSFooter, { scope: props.scope, name: "Footer", logo: props.logo, isLoggedIn: props.isLoggedIn })] }));
|
|
41
29
|
}
|
|
42
30
|
//# sourceMappingURL=NSLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSLayout.js","sourceRoot":"","sources":["../../src/components/NSLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NSLayout.js","sourceRoot":"","sources":["../../src/components/NSLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAqB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAyB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAoB,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAqBrD,MAAM,UAAU,QAAQ,CAAC,KAAqB;;IAE7C,SAAS,aAAa,CAAC,MAA0B;QAEhD,IAAI,MAAM;YACT,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;gBAC7E,OAAO,IAAI,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CACN,eAAK,EAAE,EAAE,KAAK,CAAC,EAAE,EAChB,SAAS,EAAE,GAAG,MAAM,CAAC,YAAY,IAAI,MAAA,KAAK,CAAC,SAA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CAAC,UAAU,GAC3B,IACI,CACP,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Styles from "./NSBarNotification.module.css";
|
|
2
2
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
3
|
+
import { useState } from "react"
|
|
3
4
|
|
|
4
5
|
export interface INSBarNotificationProps extends IBaseComponentProps
|
|
5
6
|
{
|
|
@@ -8,7 +9,10 @@ export interface INSBarNotificationProps extends IBaseComponentProps
|
|
|
8
9
|
color: NSBarNotificationColor;
|
|
9
10
|
onClose: () => void;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
export interface INSBarNotificationState
|
|
13
|
+
{
|
|
14
|
+
show: boolean
|
|
15
|
+
}
|
|
12
16
|
export enum NSBarNotificationColor
|
|
13
17
|
{
|
|
14
18
|
GRAY = "GRAY",
|
|
@@ -28,6 +32,7 @@ export enum NotificationType
|
|
|
28
32
|
|
|
29
33
|
export function NSBarNotification(props: INSBarNotificationProps)
|
|
30
34
|
{
|
|
35
|
+
const [state, setState] = useState<INSBarNotificationState>({ show: true });
|
|
31
36
|
let className = Styles["ns_" + props.color.toString().toLowerCase()];
|
|
32
37
|
let type = props.type;
|
|
33
38
|
let src = "";
|
|
@@ -45,20 +50,30 @@ export function NSBarNotification(props: INSBarNotificationProps)
|
|
|
45
50
|
case "Information":
|
|
46
51
|
src = "https://static.namirasoft.com/image/concept/close/info.svg";
|
|
47
52
|
}
|
|
53
|
+
if (state.show)
|
|
54
|
+
setTimeout(() =>
|
|
55
|
+
{
|
|
56
|
+
setState({ show: false })
|
|
57
|
+
}, 5000);
|
|
48
58
|
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
<>
|
|
60
|
+
{
|
|
61
|
+
state.show && (
|
|
62
|
+
<div id={props.id}
|
|
63
|
+
className={`${Styles.ns_messenger} ${className}`}
|
|
64
|
+
style={props.style}
|
|
65
|
+
>
|
|
66
|
+
<p className={`mb-0 ns-font-16-normal`}>{props.text}</p>
|
|
67
|
+
<img
|
|
68
|
+
className={Styles.ns_exit_icon}
|
|
69
|
+
src={src}
|
|
70
|
+
alt="exit"
|
|
71
|
+
width={32}
|
|
72
|
+
height={32}
|
|
73
|
+
onClick={props.onClose}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
</>)
|
|
64
79
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
1
|
import Styles from './NSLayout.module.css';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
3
|
import { NSHeader } from './NSHeader';
|
|
@@ -32,25 +31,6 @@ export interface NSLayoutState
|
|
|
32
31
|
|
|
33
32
|
export function NSLayout(props: INSLayoutProps)
|
|
34
33
|
{
|
|
35
|
-
const [showNotifications, setShowNotifications] = useState<boolean[]>(Array(props.notifications.length).fill(true));
|
|
36
|
-
|
|
37
|
-
useEffect(() =>
|
|
38
|
-
{
|
|
39
|
-
const timers = props.notifications.map((_, index) =>
|
|
40
|
-
setTimeout(() =>
|
|
41
|
-
{
|
|
42
|
-
setShowNotifications(prev =>
|
|
43
|
-
{
|
|
44
|
-
const newVisibility = [...prev];
|
|
45
|
-
newVisibility[index] = false;
|
|
46
|
-
return newVisibility;
|
|
47
|
-
});
|
|
48
|
-
}, 5000)
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return () => timers.forEach(timer => clearTimeout(timer));
|
|
52
|
-
}, [props.notifications]);
|
|
53
|
-
|
|
54
34
|
function isValidAction(action?: INSBarActionProps): action is INSBarActionProps
|
|
55
35
|
{
|
|
56
36
|
if (action)
|
|
@@ -58,7 +38,6 @@ export function NSLayout(props: INSLayoutProps)
|
|
|
58
38
|
return true;
|
|
59
39
|
return false;
|
|
60
40
|
}
|
|
61
|
-
|
|
62
41
|
return (
|
|
63
42
|
<div id={props.id}
|
|
64
43
|
className={`${Styles.ns_container} ${props.classList?.join(" ")}`}
|
|
@@ -79,15 +58,13 @@ export function NSLayout(props: INSLayoutProps)
|
|
|
79
58
|
header={props.header}
|
|
80
59
|
isLoggedIn={props.isLoggedIn}
|
|
81
60
|
/>
|
|
82
|
-
{props.notifications.map(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{isValidAction(props.action) && <NSBarAction {...props.action} ></NSBarAction>}
|
|
86
|
-
{props.banner && <NSBarHeroBanner {...props.banner} ></NSBarHeroBanner>}
|
|
61
|
+
{props.notifications.map(props => <NSBarNotification {...props}></NSBarNotification>)}
|
|
62
|
+
{isValidAction(props.action) && <NSBarAction {...props.action} ></NSBarAction >}
|
|
63
|
+
{props.banner && <NSBarHeroBanner {...props.banner} ></NSBarHeroBanner >}
|
|
87
64
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
88
65
|
{props.title &&
|
|
89
66
|
<>
|
|
90
|
-
<NSBarTitle {...props.title}></NSBarTitle>
|
|
67
|
+
<NSBarTitle {...props.title} ></NSBarTitle >
|
|
91
68
|
<NSSpace size={NSSpaceSizeType.MEDUIM} />
|
|
92
69
|
</>
|
|
93
70
|
}
|
|
@@ -101,6 +78,6 @@ export function NSLayout(props: INSLayoutProps)
|
|
|
101
78
|
logo={props.logo}
|
|
102
79
|
isLoggedIn={props.isLoggedIn}
|
|
103
80
|
/>
|
|
104
|
-
</div>
|
|
81
|
+
</div >
|
|
105
82
|
);
|
|
106
83
|
}
|