Skip to content

Commit 6104d7b

Browse files
committed
+
1 parent 5ec11c4 commit 6104d7b

File tree

1 file changed

+82
-6
lines changed

1 file changed

+82
-6
lines changed

src/ui/components/Toasts.astro

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ const toasts = [
1414
class="toasts-wrap animated_bottom"
1515
transition:persist="toasts"
1616
>
17-
<div class="by-drizzle">Product by Drizzle Team</div>
17+
<div id="product-by-drizzle" class="by-drizzle fade-out">
18+
Product by Drizzle Team
19+
</div>
1820
{
1921
toasts.map((toast, index) => (
2022
<a
@@ -35,6 +37,13 @@ const toasts = [
3537
<span class="toast-title">{toast.title}</span>
3638
<span class="toast-description">{toast.description}</span>
3739
</div>
40+
<div class="black-friday-wrap">
41+
<div class="black-friday">
42+
black
43+
<br />
44+
friday
45+
</div>
46+
</div>
3847
</div>
3948
</a>
4049
))
@@ -52,7 +61,7 @@ const toasts = [
5261
width: 100%;
5362
opacity: 1;
5463
transition: opacity 1s;
55-
margin-bottom: 32px;
64+
margin-bottom: 48px;
5665
}
5766

5867
.toasts-wrap-fade {
@@ -61,9 +70,17 @@ const toasts = [
6170
}
6271

6372
.toast {
73+
position: relative;
74+
padding: 1px;
75+
overflow: hidden;
76+
border-radius: 8px;
6477
transition: transform 0.2s cubic-bezier(0.41, 0.41, 0.35, 1.3);
6578
}
6679

80+
.toast:hover::before {
81+
opacity: 1;
82+
}
83+
6784
.toasts-wrap:has(.toast:hover) .toast {
6885
transform: none !important;
6986
}
@@ -81,10 +98,32 @@ const toasts = [
8198
display: flex;
8299
align-items: center;
83100
width: 100%;
84-
/* box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px 0px; */
85101
background: #fbfbfc;
86102
border-radius: 8px;
87103
border: 1px solid #e0e1e3;
104+
overflow: hidden;
105+
}
106+
107+
html.dark .toast::before {
108+
background-image: url("../../assets/images/dark-gradient.png");
109+
}
110+
111+
.toast::before {
112+
content: "";
113+
position: absolute;
114+
top: 50%;
115+
left: 50%;
116+
transform: translate(-50%, -50%);
117+
width: 240px;
118+
height: 240px;
119+
background-image: url("../../assets/images/light-gradient.png");
120+
background-size: 240px 240px;
121+
background-position: center center;
122+
transform: rotate(45deg) scale(1.45);
123+
animation: spin 10s linear infinite;
124+
z-index: -1;
125+
opacity: 0;
126+
transition: opacity 0.2s;
88127
}
89128

90129
.toast-text {
@@ -111,7 +150,7 @@ const toasts = [
111150

112151
@keyframes bottom {
113152
0% {
114-
transform: translateY(100%);
153+
transform: translateY(150%);
115154
opacity: 0;
116155
}
117156
75% {
@@ -166,9 +205,11 @@ const toasts = [
166205
.by-drizzle {
167206
text-transform: uppercase;
168207
font-size: 10px;
169-
bottom: -24px;
208+
bottom: -32px;
170209
position: absolute;
171-
transition: bottom 0.2s;
210+
transition:
211+
bottom 0.2s,
212+
opacity 0.3s;
172213
margin-bottom: 8px;
173214
left: 50%;
174215
color: #909090;
@@ -178,6 +219,35 @@ const toasts = [
178219
padding: 0 8px;
179220
border-bottom-left-radius: 8px;
180221
border-bottom-right-radius: 8px;
222+
opacity: 1;
223+
}
224+
225+
.fade-out {
226+
opacity: 0;
227+
}
228+
229+
.black-friday-wrap {
230+
position: absolute;
231+
right: 8px;
232+
top: 50%;
233+
transform: translateY(-50%);
234+
}
235+
236+
html.dark .black-friday {
237+
background-color: #fff;
238+
color: #000;
239+
}
240+
241+
.black-friday {
242+
transform: rotateZ(45deg);
243+
font-size: 8px;
244+
text-transform: uppercase;
245+
font-weight: 700;
246+
background-color: #111;
247+
color: #fff;
248+
padding: 3px;
249+
border-radius: 3px;
250+
line-height: normal;
181251
}
182252
</style>
183253
<style is:global>
@@ -200,6 +270,12 @@ const toasts = [
200270
</script>
201271
<script>
202272
const initToasts = () => {
273+
const productByDrizzle = document.getElementById("product-by-drizzle");
274+
if (productByDrizzle) {
275+
setTimeout(() => {
276+
productByDrizzle.classList.remove("fade-out");
277+
}, 300);
278+
}
203279
const toasts = document.querySelectorAll(
204280
"[data-toast]",
205281
) as NodeListOf<HTMLElement>;

0 commit comments

Comments
 (0)