Skip to content

Commit 6c74b1e

Browse files
Create Styling fo Toast
1 parent 70e6683 commit 6c74b1e

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

src/theme/Root.module.css

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/* Base styles for the toast container */
2+
.toastContainer {
3+
position: fixed;
4+
top: 20px;
5+
right: 24px;
6+
border: 1px solid oklch(0.69 0 0);
7+
border-radius: 8px; /* Docusaurus --radius var is often 8px */
8+
padding: 12px 16px;
9+
font-size: 15px;
10+
font-weight: 500;
11+
z-index: 2147483647;
12+
display: flex;
13+
align-items: center;
14+
gap: 12px;
15+
max-width: 380px;
16+
line-height: 1.4;
17+
backdrop-filter: blur(8px);
18+
animation: slideDownFadeOut 10s ease-in-out forwards;
19+
transition:
20+
background 0.3s ease,
21+
color 0.3s ease,
22+
box-shadow 0.3s ease;
23+
}
24+
25+
/* Light theme specific styles */
26+
.toastLight {
27+
background: oklch(0.145 0 0 / 0.85); /* Added transparency for blur */
28+
color: oklch(0.985 0 0);
29+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
30+
}
31+
32+
/* Dark theme specific styles */
33+
.toastDark {
34+
background: oklch(0.985 0 0 / 0.85); /* Added transparency for blur */
35+
color: oklch(0.145 0 0);
36+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
37+
}
38+
39+
/* Style for the link inside the toast */
40+
.toastLink {
41+
text-decoration: underline;
42+
font-weight: 600;
43+
}
44+
.toastLight .toastLink {
45+
color: oklch(0.985 0 0); /* White in light mode */
46+
}
47+
.toastDark .toastLink {
48+
color: oklch(0.205 0 0); /* Dark in dark mode */
49+
}
50+
51+
/* Styles for the content area */
52+
.toastContent {
53+
flex-grow: 1; /* Allow content to fill space */
54+
}
55+
56+
/* Styles for the new icon */
57+
.toastIcon {
58+
flex-shrink: 0; /* Prevent icon from shrinking */
59+
/* Match icon color to text color */
60+
color: currentColor;
61+
opacity: 0.8;
62+
}
63+
64+
/* Minimalist close button */
65+
.toastCloseButton {
66+
flex-shrink: 0;
67+
background: none;
68+
border: none;
69+
padding: 4px;
70+
margin: -4px; /* Offset padding to align */
71+
line-height: 1;
72+
font-size: 20px;
73+
font-weight: 600;
74+
color: currentColor;
75+
opacity: 0.5;
76+
cursor: pointer;
77+
border-radius: 4px;
78+
transition:
79+
opacity 0.2s ease,
80+
background 0.2s ease;
81+
}
82+
83+
.toastCloseButton:hover {
84+
opacity: 1;
85+
}
86+
.toastLight .toastCloseButton:hover {
87+
background: oklch(1 0 0 / 0.1); /* Faint white bg on hover */
88+
}
89+
.toastDark .toastCloseButton:hover {
90+
background: oklch(0 0 0 / 0.1); /* Faint black bg on hover */
91+
}
92+
93+
/* Animation keyframes with a subtle scale for "pop" */
94+
@keyframes slideDownFadeOut {
95+
0% {
96+
opacity: 0;
97+
transform: translateY(-10px) scale(0.95);
98+
}
99+
10%,
100+
90% {
101+
opacity: 1;
102+
transform: translateY(0) scale(1);
103+
}
104+
100% {
105+
opacity: 0;
106+
transform: translateY(-10px) scale(0.95);
107+
}
108+
}

0 commit comments

Comments
 (0)