Skip to content

Commit 55e9645

Browse files
committed
Rework mobile menu toggle
Fix functionality, use event listener, remove unused CSS, fix references in JS
1 parent 2f149bf commit 55e9645

File tree

3 files changed

+43
-318
lines changed

3 files changed

+43
-318
lines changed

site/themes/arangodb-docs-theme/layouts/partials/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--LOGO-->
44
<div class="header-block-left">
55
<div class="mobile-menu-toggle">
6-
<button class="sidebar-toggle-navigation" onclick="showSidebarHandler()">
6+
<button class="sidebar-toggle-navigation">
77
<svg width="1.33em" height="1.33em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
88
</button>
99
</div>

site/themes/arangodb-docs-theme/static/css/theme.css

Lines changed: 38 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,9 @@ body .page-container {
650650
display: flex;
651651
}
652652

653-
.sidebar code {
654-
color: var(--gray-100);
655-
background: transparent;
656-
border: 0;
657-
padding: 0;
658-
}
659653

660-
.sidebar > .sidebar-toggle-navigation {
654+
/*
655+
.sidebar-toggle-navigation {
661656
position: fixed;
662657
bottom: 3vh;
663658
left: 0.2vw;
@@ -669,14 +664,13 @@ body .page-container {
669664
-webkit-justify-content: center;
670665
justify-content: center;
671666
cursor: pointer;
672-
-webkit-transition: 150ms ease-in-out;
673667
background-color: var(--gray-950);
674668
z-index: 999;
675669
border: 1px solid rgb(106 170 33/0.3);
676670
border-radius: 24px;
677671
}
678672
679-
.sidebar > .sidebar-toggle-navigation::after {
673+
.sidebar-toggle-navigation::after {
680674
font-family: "Font Awesome 5 Free";
681675
content: "\f054";
682676
display: inline-block;
@@ -687,29 +681,33 @@ body .page-container {
687681
color: var(--gray-100);
688682
}
689683
690-
.sidebar.active > .sidebar-toggle-navigation {
684+
.main-nav.active > .sidebar-toggle-navigation {
691685
left: 286px;
692686
}
687+
*/
693688

694689

695690
@media screen and (max-width: 1024px) {
696-
.sidebar > .sidebar-toggle-navigation,
697-
.sidebar.active > .sidebar-toggle-navigation {
691+
/*
692+
.main-nav > .sidebar-toggle-navigation,
693+
.main-nav.active > .sidebar-toggle-navigation {
698694
display: none;
699695
}
696+
*/
700697
.mobile-menu-toggle {
701698
display: block;
702699
}
703700
}
704701

705702

706-
707-
.sidebar.active > .sidebar-toggle-navigation::after {
703+
/*
704+
.main-nav.active > .sidebar-toggle-navigation::after {
708705
font-family: "Font Awesome 5 Free";
709706
content: "\f053";
710707
}
708+
*/
711709

712-
@media screen and (min-width: 1025px) {
710+
@media screen and (min-width: 769px) {
713711
.mobile-menu-toggle {
714712
display: none;
715713
}
@@ -817,94 +815,27 @@ header .logo {
817815
height: 2rem;
818816
}
819817

820-
/* */
821-
822-
/*
823-
@media screen and (max-width: 768px) {
824-
.version-selector {
825-
border: none;
826-
}
827-
}
828-
829-
@media screen and (max-width: 768px) {
830-
.arangodb-version {
831-
width: 4rem;
832-
}
833-
}
834-
*/
835-
836818
/* end Header */
837819

838-
/* Menu */
839-
.menu-iframe {
840-
grid-area: sidenav;
841-
display: flex;
842-
align-items: stretch;
843-
position: sticky;
844-
z-index: 2;
845-
top: 4rem;
846-
height: 101vh;
847-
background-color: var(--gray-950);
848-
left: 0;
849-
width: 0;
850-
transition: width 0.3s ease-in-out;
851-
border: none;
852-
}
853-
854-
.sidebar {
855-
grid-area: sidenav;
856-
display: flex;
857-
align-items: stretch;
858-
position: fixed;
859-
z-index: 9999;
860-
top: 64px;
861-
height: calc(100vh - 64px);
862-
left: 0;
863-
width: 0;
864-
background-color: var(--gray-950);
865-
}
866-
867-
.sidebar .sidenav-navigation {
868-
opacity: 0;
869-
}
870-
.sidebar.active .sidenav-navigation {
871-
opacity: 1;
872-
}
873-
874-
.menu-iframe.active,
875-
.sidebar.active {
820+
.main-nav.active {
876821
width: 300px;
877822
}
878823

879824
@media screen and (max-width: 768px) {
880-
.menu-iframe.active, .sidebar.active {
825+
.main-nav-ol {
826+
opacity: 0;
827+
}
828+
829+
.main-nav.active .main-nav-ol {
830+
opacity: 1;
831+
}
832+
833+
.main-nav.active {
881834
width: 100%;
835+
display: block;
882836
}
883837
}
884838

885-
.menu-mobile {
886-
display: none;
887-
}
888-
889-
.sidenav-container-flex {
890-
display: flex;
891-
flex-direction: column;
892-
flex: 1;
893-
overflow: hidden;
894-
position: relative;
895-
z-index: 400;
896-
overflow-y: scroll;
897-
-ms-overflow-style: none; /* IE and Edge */
898-
scrollbar-width: none; /* Firefox */
899-
}
900-
.sidenav-container-flex::-webkit-scrollbar {
901-
display: none;
902-
}
903-
904-
.sidenav-navigation {
905-
overflow: auto;
906-
margin: 0 10px 0 0;
907-
}
908839

909840
.content-wrapper {
910841
display: flex;
@@ -915,151 +846,6 @@ header .logo {
915846
position: relative;
916847
}
917848

918-
.sidebar a.padding {
919-
padding: 0 1rem;
920-
}
921-
922-
.sidebar ul {
923-
list-style: none;
924-
padding: 0;
925-
margin: 0;
926-
}
927-
928-
.sidebar li {
929-
padding: 0;
930-
931-
}
932-
933-
.sidebar ul.topics {
934-
margin-bottom: 2rem;
935-
padding: 0.5rem 1rem;
936-
}
937-
938-
.sidebar ul.topics label {
939-
cursor: pointer;
940-
display: inline;
941-
height: 1rem;
942-
margin: 6px 16px 0 0;
943-
position: absolute;
944-
width: 1rem;
945-
font-size: 13px;
946-
line-height: 1.4rem;
947-
right: 0;
948-
}
949-
950-
.submenu {
951-
display: none;
952-
}
953-
954-
955-
.sidebar ul.topics li.parent > ul,
956-
.sidebar ul.topics li.active > ul,
957-
.sidebar ul.topics li.alwaysopen > ul {
958-
display: block;
959-
}
960-
961-
.sidebar ul.topics li.active > a {
962-
box-sizing: border-box;
963-
border-radius: 8px;
964-
--tw-bg-opacity: 0.5;
965-
background-color: rgba(255, 255, 255, 0.05);
966-
}
967-
968-
969-
970-
.sidebar ul.topics > li a {
971-
/*font-size: 13px;*/
972-
line-height: 1.3rem;
973-
}
974-
975-
976-
.sidebar ul li a {
977-
padding-left: 1rem;
978-
padding-right: 1rem;
979-
display: flex;
980-
padding: 6px 0;
981-
transition: 0.5s;
982-
}
983-
984-
.sidebar ul.topics li > a {
985-
display: flex;
986-
padding-left: 1rem;
987-
padding-right: 1rem;
988-
text-overflow: ellipsis;
989-
white-space: break-spaces;
990-
color: var(--gray-100);
991-
margin-bottom: 8px;
992-
font-weight: 400;
993-
}
994-
995-
.sidebar ul li a.toggle,
996-
.sidebar ul li.leaf a {
997-
margin-right: -0.5rem;
998-
padding-right: 1.5rem;
999-
border-radius: 8px;
1000-
}
1001-
1002-
.sidebar ul li a:hover {
1003-
box-sizing: border-box;
1004-
border: 0;
1005-
text-decoration: none;
1006-
background-color: var(--gray-900);
1007-
}
1008-
1009-
.sidebar ul.topics > li a::first-line {
1010-
line-height: 1rem;
1011-
}
1012-
1013-
.sect > label.closed::before {
1014-
font-family: "Font Awesome 5 Free";
1015-
content: "\f078";
1016-
display: inline-block;
1017-
/* padding-right: 3px; */
1018-
vertical-align: middle;
1019-
font-weight: 900;
1020-
font-size: 10px;
1021-
padding-top: 0;
1022-
color: var(--gray-300);
1023-
}
1024-
1025-
.sect > label.open::before {
1026-
font-family: "Font Awesome 5 Free";
1027-
content: "\f077";
1028-
display: inline-block;
1029-
/* padding-right: 3px; */
1030-
vertical-align: middle;
1031-
font-weight: 900;
1032-
font-size: 10px;
1033-
padding-top: 0;
1034-
color: var(--gray-300);
1035-
}
1036-
1037-
.leaf > a {
1038-
align-items: center;
1039-
position: relative;
1040-
}
1041-
1042-
1043-
.menu-title {
1044-
pointer-events: none;
1045-
}
1046-
1047-
.sidebar ul.topics li.parent > a > .menu-title,
1048-
.sidebar ul.topics li.active > a > .menu-title,
1049-
.sidebar ul.topics li.alwaysopen > a > .menu-title {
1050-
font-weight: 400;
1051-
color: var(--color-electric-lime);
1052-
}
1053-
1054-
.sidebar ul li li {
1055-
padding-left: 1rem;
1056-
}
1057-
1058-
1059-
/* end Menu */
1060-
1061-
1062-
1063849
/* Main Article */
1064850
.container-main {
1065851
max-width: 100%;
@@ -2060,26 +1846,6 @@ nav.pagination .next {
20601846
color: #130909;
20611847
}
20621848

2063-
.sidebar ::-webkit-scrollbar {
2064-
width: 10px;
2065-
}
2066-
2067-
.sidebar ::-webkit-scrollbar-thumb {
2068-
background: var(--gray-500);
2069-
width: 6px;
2070-
border-radius: 20px;
2071-
}
2072-
2073-
.sidebar ::-webkit-scrollbar-thumb:hover {
2074-
background: var(--gray-200);
2075-
}
2076-
2077-
.sidebar ::-webkit-scrollbar-track {
2078-
background: var(--gray-950);
2079-
}
2080-
2081-
2082-
20831849
.DocSearch.DocSearch-Container {
20841850
z-index: 9999;
20851851
}
@@ -2177,6 +1943,20 @@ nav.pagination .next {
21771943
scrollbar-width: thin;
21781944
scrollbar-color: var(--gray-300) var(--gray-100);
21791945
user-select: none;
1946+
z-index: 9999;
1947+
}
1948+
1949+
.main-nav code {
1950+
color: var(--gray-100);
1951+
background: transparent;
1952+
border: 0;
1953+
padding: 0;
1954+
}
1955+
1956+
@media screen and (max-width: 768px) {
1957+
.main-nav {
1958+
display: none;
1959+
}
21801960
}
21811961

21821962
.main-nav-ol,

0 commit comments

Comments
 (0)