titaned-frontend-library 1.0.21 → 1.0.22
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/AnnouncementBanner.scss +16 -32
- package/dist/index.cjs +6 -6
- package/dist/index.css +1 -1
- package/dist/index.js +188 -192
- package/dist/interfaces/components.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/common/AnnouncementBanner/AnnouncementBanner.scss +16 -32
- package/src/components/common/AnnouncementBanner/AnnouncementBanner.tsx +14 -13
- package/src/interfaces/components.ts +1 -0
package/package.json
CHANGED
|
@@ -4,12 +4,26 @@
|
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: left;
|
|
6
6
|
position: relative;
|
|
7
|
-
background-color: var(--bg-body);
|
|
8
7
|
color: var(--text-primary);
|
|
9
8
|
padding: 6px 20px;
|
|
10
9
|
line-height: 1.2;
|
|
11
10
|
word-break: break-word;
|
|
12
11
|
flex-wrap: wrap;
|
|
12
|
+
transform-origin: top;
|
|
13
|
+
|
|
14
|
+
transform: scaleY(0);
|
|
15
|
+
opacity: 0;
|
|
16
|
+
transition: transform 0.8s ease, opacity 0.8s ease;
|
|
17
|
+
|
|
18
|
+
&.showBanner {
|
|
19
|
+
transform: scaleY(1);
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.hideBanner {
|
|
24
|
+
transform: scaleY(0);
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
13
27
|
|
|
14
28
|
|
|
15
29
|
.announcement-content {
|
|
@@ -17,7 +31,7 @@
|
|
|
17
31
|
text-align: left;
|
|
18
32
|
|
|
19
33
|
h1, h2, h3, h4, h5, h6, p, span, strong, em, i, b {
|
|
20
|
-
margin: 0
|
|
34
|
+
margin: 0;
|
|
21
35
|
color: var(--text-primary);
|
|
22
36
|
}
|
|
23
37
|
|
|
@@ -67,36 +81,6 @@
|
|
|
67
81
|
height: 18px;
|
|
68
82
|
width: 18px;
|
|
69
83
|
}
|
|
70
|
-
|
|
71
|
-
&.showBanner {
|
|
72
|
-
animation: expandBanner 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.hideBanner {
|
|
76
|
-
animation: collapseBanner 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@keyframes expandBanner {
|
|
81
|
-
from {
|
|
82
|
-
max-height: 0;
|
|
83
|
-
opacity: 0;
|
|
84
|
-
}
|
|
85
|
-
to {
|
|
86
|
-
max-height: 100%;
|
|
87
|
-
opacity: 1;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@keyframes collapseBanner {
|
|
92
|
-
from {
|
|
93
|
-
max-height: 100%;
|
|
94
|
-
opacity: 1;
|
|
95
|
-
}
|
|
96
|
-
to {
|
|
97
|
-
max-height: 0;
|
|
98
|
-
opacity: 0;
|
|
99
|
-
}
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
@media only screen and (max-width: 650px) {
|
|
@@ -7,6 +7,7 @@ import './AnnouncementBanner.scss';
|
|
|
7
7
|
const AnnouncementBanner: React.FC<AnnouncementBannerProps> = ({
|
|
8
8
|
announcementType,
|
|
9
9
|
data,
|
|
10
|
+
backgroundColor,
|
|
10
11
|
}) => {
|
|
11
12
|
const [isVisible, setIsVisible] = useState<boolean>(() => {
|
|
12
13
|
const lastClosed = localStorage.getItem(announcementType);
|
|
@@ -18,17 +19,23 @@ const AnnouncementBanner: React.FC<AnnouncementBannerProps> = ({
|
|
|
18
19
|
return true;
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
const [animationClass, setAnimationClass] = useState<string>('showBanner');
|
|
22
24
|
|
|
23
25
|
const handleClose = () => {
|
|
24
|
-
|
|
26
|
+
setAnimationClass('hideBanner');
|
|
25
27
|
setTimeout(() => {
|
|
26
28
|
setIsVisible(false);
|
|
27
|
-
setIsAnimating(false);
|
|
28
29
|
localStorage.setItem(announcementType, Date.now().toString());
|
|
29
|
-
},
|
|
30
|
+
}, 800);
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (isVisible) {
|
|
35
|
+
setAnimationClass('showBanner');
|
|
36
|
+
}
|
|
37
|
+
}, [isVisible]);
|
|
38
|
+
|
|
32
39
|
useEffect(() => {
|
|
33
40
|
const checkBannerReset = () => {
|
|
34
41
|
const lastClosed = localStorage.getItem(announcementType);
|
|
@@ -46,17 +53,11 @@ const AnnouncementBanner: React.FC<AnnouncementBannerProps> = ({
|
|
|
46
53
|
return () => clearInterval(interval);
|
|
47
54
|
}, [announcementType]);
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
56
|
+
|
|
57
|
+
if (!data || data.trim() === '' || !isVisible) return null;
|
|
52
58
|
|
|
53
59
|
return (
|
|
54
|
-
<div
|
|
55
|
-
className={`announcement-banner ${
|
|
56
|
-
isAnimating ? 'hideBanner' : 'showBanner'
|
|
57
|
-
}`}
|
|
58
|
-
style={{ display: !isVisible && !isAnimating ? 'none' : 'flex' }}
|
|
59
|
-
>
|
|
60
|
+
<div className={`announcement-banner ${animationClass}`} style={{ backgroundColor: backgroundColor || 'var(--bg-body)' }}>
|
|
60
61
|
<div
|
|
61
62
|
className="announcement-content"
|
|
62
63
|
dangerouslySetInnerHTML={{ __html: data }}
|