namirasoft-site-react 1.4.57 → 1.4.58
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.
|
@@ -24,7 +24,7 @@ export function NSDownTimer(props) {
|
|
|
24
24
|
}
|
|
25
25
|
return timeLeft;
|
|
26
26
|
}
|
|
27
|
-
return (_jsxs("div", { id: props.id, className: `${Styles.
|
|
27
|
+
return (_jsxs("div", { id: props.id, className: `${Styles.ns_down_timer_container} ${(_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")}`, style: props.style, children: [_jsxs("figure", { className: Styles.ns_figure, children: [_jsx("img", { src: 'https://static.namirasoft.com/image/concept/countdown/grey.svg', alt: 'CountDown', width: 48, height: 48 }), _jsx("figcaption", { children: props.text })] }), _jsxs("div", { className: Styles.ns_down_timer_time_container, children: [_jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.days} ` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "DAY" })] }), _jsx("span", { className: `${Styles.ns_semi_colon} `, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.hours}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "HOUR" })] }), _jsx("span", { className: `${Styles.ns_semi_colon} `, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.minutes}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "MIN" })] }), _jsx("span", { className: `${Styles.ns_semi_colon} `, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.seconds} ` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "SEC" })] })] })] }));
|
|
28
28
|
}
|
|
29
29
|
;
|
|
30
30
|
//# sourceMappingURL=NSDownTimer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSDownTimer.js","sourceRoot":"","sources":["../../src/components/NSDownTimer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAQ9C,MAAM,UAAU,WAAW,CAAC,KAAuB;;
|
|
1
|
+
{"version":3,"file":"NSDownTimer.js","sourceRoot":"","sources":["../../src/components/NSDownTimer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAQ9C,MAAM,UAAU,WAAW,CAAC,KAAuB;;IAElD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QAEd,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAE9B,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjB,SAAS,iBAAiB,CAAC,IAAU;QAEpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QAElD,IAAI,QAAQ,GAA0E,EAAE,CAAC;QACzF,IAAI,UAAU,GAAG,CAAC,EAClB,CAAC;YACA,QAAQ,GAAG;gBACV,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EACN,eAAM,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,GAAG,kBAAU,EACrD,eAAK,SAAS,EAAC,8DAA8D,aAC5E,eAAM,SAAS,EAAE,MAAM,CAAC,uBAAuB,YAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAQ,EAC7E,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,qBAAa,IAC5D,EACN,eAAM,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,GAAG,kBAAU,EACrD,eAAK,SAAS,EAAC,8DAA8D,aAC5E,eAAM,SAAS,EAAE,MAAM,CAAC,uBAAuB,YAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAQ,EAC/E,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,oBAAY,IAC3D,EACN,eAAM,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,GAAG,kBAAU,EACrD,eAAK,SAAS,EAAC,8DAA8D,aAC5E,eAAM,SAAS,EAAE,MAAM,CAAC,uBAAuB,YAAG,GAAG,QAAQ,CAAC,OAAO,GAAG,GAAQ,EAChF,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,oBAAY,IAC3D,IACD,IACD,CACN,CAAC;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.ns_down_timer_container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: left;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.ns_figure {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
margin: 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.ns_figure figcaption {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin: 0;
|
|
20
|
+
color: #141B5C;
|
|
21
|
+
padding: 2px 0;
|
|
22
|
+
max-width: 100px;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
.ns_down_timer_time_container {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
align-items: flex-start;
|
|
31
|
+
padding: 0 8px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.ns_down_timer_time_left {
|
|
35
35
|
font-size: 16px;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
color: #141B5C;
|
|
38
|
+
margin: 0;
|
|
39
|
+
padding-left: 2px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.ns_down_timer_time_left_unit {
|
|
43
43
|
font-size: 12px;
|
|
44
|
-
|
|
44
|
+
font-weight: 400;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.ns_semi_colon {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
padding: 0;
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.ns_down_timer_container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: left;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.ns_figure {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
margin: 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.ns_figure figcaption {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin: 0;
|
|
20
|
+
color: #141B5C;
|
|
21
|
+
padding: 2px 0;
|
|
22
|
+
max-width: 100px;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
.ns_down_timer_time_container {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
align-items: flex-start;
|
|
31
|
+
padding: 0 8px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.ns_down_timer_time_left {
|
|
35
35
|
font-size: 16px;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
color: #141B5C;
|
|
38
|
+
margin: 0;
|
|
39
|
+
padding-left: 2px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.ns_down_timer_time_left_unit {
|
|
43
43
|
font-size: 12px;
|
|
44
|
-
|
|
44
|
+
font-weight: 400;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.ns_semi_colon {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
padding: 0;
|
|
51
51
|
}
|
|
@@ -3,45 +3,45 @@ import { IBaseComponentProps } from '../props/IBaseComponentProps';
|
|
|
3
3
|
import Styles from './NSDownTimer.module.css';
|
|
4
4
|
export interface NSDownTimerProps extends IBaseComponentProps
|
|
5
5
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
date: Date;
|
|
7
|
+
text: string;
|
|
8
|
+
expire_text?: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function NSDownTimer(props: NSDownTimerProps)
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft(props.date));
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
useEffect(() =>
|
|
16
|
+
{
|
|
17
|
+
const timer = setInterval(() =>
|
|
18
|
+
{
|
|
19
|
+
setTimeLeft(calculateTimeLeft(props.date));
|
|
20
|
+
}, 1000);
|
|
21
|
+
return () => clearInterval(timer);
|
|
22
|
+
}, [props.date]);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
function calculateTimeLeft(date: Date)
|
|
25
|
+
{
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const difference = date.getTime() - now.getTime();
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
let timeLeft: { days?: number; hours?: number; minutes?: number; seconds?: number } = {};
|
|
30
|
+
if (difference > 0)
|
|
31
|
+
{
|
|
32
|
+
timeLeft = {
|
|
33
|
+
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
|
|
34
|
+
hours: Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
|
|
35
|
+
minutes: Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)),
|
|
36
|
+
seconds: Math.floor((difference % (1000 * 60)) / 1000),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return timeLeft;
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
42
|
<div
|
|
43
43
|
id={props.id}
|
|
44
|
-
className={`${Styles.
|
|
44
|
+
className={`${Styles.ns_down_timer_container} ${props.classList?.join(" ")}`}
|
|
45
45
|
style={props.style}
|
|
46
46
|
>
|
|
47
47
|
<figure className={Styles.ns_figure}>
|
|
@@ -52,27 +52,27 @@ export function NSDownTimer(props: NSDownTimerProps)
|
|
|
52
52
|
height={48} />
|
|
53
53
|
<figcaption>{props.text}</figcaption>
|
|
54
54
|
</figure>
|
|
55
|
-
<div className={Styles.
|
|
55
|
+
<div className={Styles.ns_down_timer_time_container}>
|
|
56
56
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
57
|
-
<span className={Styles.
|
|
58
|
-
<span className={Styles.
|
|
57
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.days} `}</span>
|
|
58
|
+
<span className={Styles.ns_down_timer_time_left_unit}>DAY</span>
|
|
59
59
|
</div>
|
|
60
60
|
<span className={`${Styles.ns_semi_colon} `}>:</span>
|
|
61
61
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
62
|
-
<span className={Styles.
|
|
63
|
-
<span className={Styles.
|
|
62
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.hours}`}</span>
|
|
63
|
+
<span className={Styles.ns_down_timer_time_left_unit}>HOUR</span>
|
|
64
64
|
</div>
|
|
65
65
|
<span className={`${Styles.ns_semi_colon} `}>:</span>
|
|
66
66
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
67
|
-
<span className={Styles.
|
|
68
|
-
<span className={Styles.
|
|
67
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.minutes}`}</span>
|
|
68
|
+
<span className={Styles.ns_down_timer_time_left_unit}>MIN</span>
|
|
69
69
|
</div>
|
|
70
70
|
<span className={`${Styles.ns_semi_colon} `}>:</span>
|
|
71
71
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
72
|
-
<span className={Styles.
|
|
73
|
-
<span className={Styles.
|
|
72
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.seconds} `}</span>
|
|
73
|
+
<span className={Styles.ns_down_timer_time_left_unit}>SEC</span>
|
|
74
74
|
</div>
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
77
|
-
|
|
77
|
+
);
|
|
78
78
|
};
|