Skip to content

Commit 009aa7e

Browse files
authored
Merge pull request #1507 from Abhash-Chakraborty/Abhash/fix-toast-overlay-1500
fix: dismiss leaderboard toast cleanly
2 parents 29d84a2 + cd6e97e commit 009aa7e

2 files changed

Lines changed: 40 additions & 13 deletions

File tree

src/css/custom.css

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ a.menu__link.menu__link--active div span:first-child {
147147
font-weight: 600;
148148
}
149149

150-
151-
152-
153150
/* Technical theme */
154151
.custom-sidebar-technical > .menu__list-item-collapsible > .menu__link {
155152
background: linear-gradient(135deg, #ff6b6b, #ee5a24);
@@ -407,7 +404,9 @@ body {
407404
padding: 6px;
408405
border-radius: 6px;
409406
color: var(--ifm-navbar-link-color);
410-
transition: color 0.2s ease, background-color 0.2s ease;
407+
transition:
408+
color 0.2s ease,
409+
background-color 0.2s ease;
411410
}
412411

413412
.navbar-social-icon:hover {
@@ -1450,10 +1449,34 @@ html {
14501449
}
14511450

14521451
.algolia-sitesearch-navbar .sitesearch-button .keyboard-shortcut {
1452+
display: inline-flex !important;
1453+
align-items: center !important;
1454+
gap: 3px !important;
1455+
height: 20px;
14531456
margin-left: 10px;
1457+
padding: 0 6px !important;
1458+
border: 1px solid var(--ifm-color-emphasis-300) !important;
1459+
border-radius: 5px !important;
1460+
background: var(--ifm-color-emphasis-100) !important;
1461+
color: var(--ifm-color-emphasis-700) !important;
1462+
font-size: 12px !important;
1463+
line-height: 1 !important;
14541464
flex-shrink: 0;
14551465
}
14561466

1467+
.algolia-sitesearch-navbar .sitesearch-button .keyboard-shortcut > * {
1468+
min-width: 0 !important;
1469+
height: auto !important;
1470+
padding: 0 !important;
1471+
border: 0 !important;
1472+
border-radius: 0 !important;
1473+
background: transparent !important;
1474+
box-shadow: none !important;
1475+
color: inherit !important;
1476+
font: inherit !important;
1477+
line-height: inherit !important;
1478+
}
1479+
14571480
[data-theme="dark"] .explore-btn:hover {
14581481
color: white;
14591482
}

src/theme/Root.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ export default function Root({ children }: { children: React.ReactNode }) {
3636
const timerRef = useRef<NodeJS.Timeout | null>(null);
3737
const location = useLocation();
3838
const [isInitialLoad, setIsInitialLoad] = useState(true);
39-
39+
4040
// Check if current page is sponsors page
41-
const isSponsorsPage = location.pathname === '/our-sponsors/' || location.pathname === '/our-sponsors';
41+
const isSponsorsPage =
42+
location.pathname === "/our-sponsors/" ||
43+
location.pathname === "/our-sponsors";
4244

4345
// Theme detection logic
4446
useEffect(() => {
@@ -63,26 +65,28 @@ export default function Root({ children }: { children: React.ReactNode }) {
6365

6466
// Show toast on initial load for all pages
6567
useEffect(() => {
66-
if (isInitialLoad) {
67-
setShowToast(true);
68-
timerRef.current = setTimeout(() => setShowToast(false), 10000);
69-
setIsInitialLoad(false);
70-
}
68+
setShowToast(true);
69+
timerRef.current = setTimeout(() => {
70+
setShowToast(false);
71+
timerRef.current = null;
72+
}, 10000);
73+
setIsInitialLoad(false);
7174

7275
return () => {
7376
if (timerRef.current) {
7477
clearTimeout(timerRef.current);
78+
timerRef.current = null;
7579
}
7680
};
77-
}, [isInitialLoad]);
81+
}, []);
7882

7983
// Show toast on navigation only for sponsors page
8084
useEffect(() => {
8185
if (!isInitialLoad && isSponsorsPage) {
8286
if (timerRef.current) {
8387
clearTimeout(timerRef.current);
8488
}
85-
89+
8690
setShowToast(false);
8791
const showTimer = setTimeout(() => {
8892
setShowToast(true);

0 commit comments

Comments
 (0)