Skip to content

Commit b1cee82

Browse files
committed
Enhance mobile navigation functionality with safety checks and icon toggle improvements
1 parent 25dcee7 commit b1cee82

2 files changed

Lines changed: 123 additions & 16 deletions

File tree

docs/assets/css/styles.css

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,25 +698,83 @@ input[type="color"] {
698698
.footer-column {
699699
width: 100%;
700700
}
701-
}
702701

703-
@media (max-width: 576px) {
704-
.hero-actions {
702+
/* Fix for table overflow */
703+
.docs-table {
704+
display: block;
705+
width: 100%;
706+
overflow-x: auto;
707+
-webkit-overflow-scrolling: touch;
708+
}
709+
710+
/* Fix for code examples overflow */
711+
.code-block {
712+
overflow-x: auto;
713+
}
714+
715+
/* Make tabs scroll horizontally if needed */
716+
.tabs {
717+
display: flex;
718+
overflow-x: auto;
719+
-webkit-overflow-scrolling: touch;
720+
}
721+
722+
/* Fix for demo controls */
723+
.control-row {
705724
flex-direction: column;
706-
align-items: center;
725+
}
726+
727+
.control-item {
728+
width: 100%;
729+
margin-bottom: 1rem;
730+
}
731+
732+
.hero-actions {
733+
flex-wrap: wrap;
707734
gap: 1rem;
708735
}
709736

710737
.btn+.btn {
711738
margin-left: 0;
712739
}
713740

741+
/* Improve feature grid */
742+
.features {
743+
grid-template-columns: 1fr;
744+
}
745+
746+
/* Improve steps layout */
747+
.steps {
748+
flex-direction: column;
749+
}
750+
751+
.step {
752+
width: 100%;
753+
margin-bottom: 2rem;
754+
}
755+
}
756+
757+
/* Further optimizations for very small screens */
758+
@media (max-width: 480px) {
759+
.section-title {
760+
font-size: 1.75rem;
761+
}
762+
763+
.section-subtitle {
764+
font-size: 1rem;
765+
}
766+
714767
.use-cases {
715768
grid-template-columns: 1fr;
716769
}
717770

718-
.docs-table {
719-
font-size: 0.8rem;
771+
.footer-content {
772+
flex-direction: column;
773+
}
774+
775+
.footer-column {
776+
width: 100%;
777+
margin-bottom: 2rem;
720778
}
721779
}
722780

@@ -729,8 +787,48 @@ input[type="color"] {
729787
font-size: 1.5rem;
730788
cursor: pointer;
731789
padding: 0.5rem;
790+
position: relative;
791+
z-index: 1000;
792+
}
793+
794+
.overlay {
795+
display: none;
796+
position: fixed;
797+
top: 0;
798+
left: 0;
799+
width: 100%;
800+
height: 100%;
801+
background-color: rgba(0, 0, 0, 0.5);
802+
z-index: 998;
803+
}
804+
805+
.overlay.active {
806+
display: block;
732807
}
733808

734-
.mobile-nav-toggle:focus {
735-
outline: none;
809+
/* Documentation improvements - Fix table overflow */
810+
.docs-table {
811+
width: 100%;
812+
border-collapse: separate;
813+
border-spacing: 0;
814+
margin: 2rem 0;
815+
border: 1px solid var(--border-color);
816+
border-radius: var(--radius);
817+
overflow: hidden;
818+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
819+
}
820+
821+
/* Make all tables responsive at all viewport sizes */
822+
@media (max-width: 1000px) {
823+
.docs-table {
824+
display: block;
825+
overflow-x: auto;
826+
-webkit-overflow-scrolling: touch;
827+
}
828+
829+
.parameter-table {
830+
display: block;
831+
overflow-x: auto;
832+
-webkit-overflow-scrolling: touch;
833+
}
736834
}

docs/assets/js/mobile-nav.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ document.addEventListener('DOMContentLoaded', function () {
77
const overlay = document.querySelector('.overlay');
88
const navLinkItems = document.querySelectorAll('.nav-link a');
99

10+
if (!mobileNavToggle || !navLinks || !overlay) {
11+
return; // Safety check in case elements don't exist
12+
}
13+
1014
// Function to toggle the mobile menu
1115
function toggleMobileNav() {
1216
navLinks.classList.toggle('active');
1317
overlay.classList.toggle('active');
1418

1519
// Toggle between menu and close icons
1620
const icon = mobileNavToggle.querySelector('i');
17-
if (icon.classList.contains('fa-bars')) {
18-
icon.classList.remove('fa-bars');
19-
icon.classList.add('fa-times');
20-
} else {
21-
icon.classList.remove('fa-times');
22-
icon.classList.add('fa-bars');
21+
if (icon) {
22+
if (icon.classList.contains('fa-bars')) {
23+
icon.classList.remove('fa-bars');
24+
icon.classList.add('fa-times');
25+
} else {
26+
icon.classList.remove('fa-times');
27+
icon.classList.add('fa-bars');
28+
}
2329
}
2430
}
2531

@@ -43,8 +49,11 @@ document.addEventListener('DOMContentLoaded', function () {
4349
if (window.innerWidth > 768 && navLinks.classList.contains('active')) {
4450
navLinks.classList.remove('active');
4551
overlay.classList.remove('active');
46-
mobileNavToggle.querySelector('i').classList.remove('fa-times');
47-
mobileNavToggle.querySelector('i').classList.add('fa-bars');
52+
const icon = mobileNavToggle.querySelector('i');
53+
if (icon) {
54+
icon.classList.remove('fa-times');
55+
icon.classList.add('fa-bars');
56+
}
4857
}
4958
});
5059
});

0 commit comments

Comments
 (0)