Skip to content

Commit d026511

Browse files
authored
fix: fix mobile version (#93)
1 parent 2668b8a commit d026511

File tree

5 files changed

+76
-6
lines changed

5 files changed

+76
-6
lines changed

src/scss/custom.scss

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ body {
9090
--ifm-breadcrumb-color-active: theme("colors.indigo.600");
9191
--docsearch-searchbox-background: transparent !important;
9292
--max-width: 92rem;
93+
--ifm-navbar-sidebar-width: 100vw;
9394
}
9495

9596
/* Dark mode. */
@@ -113,6 +114,11 @@ html[data-theme-override="light"] {
113114
color: theme("colors.neutral.900") !important;
114115
--ifm-navbar-link-color: theme("colors.neutral.900");
115116
--ifm-navbar-link-hover-color: theme("colors.neutral.900");
117+
--ifm-navbar-background-color: #fff;
118+
}
119+
120+
.docs-wrapper .navbar__items {
121+
@apply bg-white dark:bg-neutral-950;
116122
}
117123

118124
.docs-wrapper .main-wrapper,
@@ -128,7 +134,7 @@ html[data-theme-override="light"] {
128134
transition: transform 0.25s ease-in-out;
129135
transform: translateY(0);
130136
will-change: transform;
131-
@apply justify-center px-0 shadow-none dark:fill-white;
137+
@apply justify-center px-0 text-neutral-600 shadow-none dark:fill-white dark:text-neutral-400;
132138

133139
.navbar__inner {
134140
max-width: var(--max-width);
@@ -156,12 +162,32 @@ html[data-theme-override="light"] {
156162
}
157163
}
158164

165+
.navbar-sidebar {
166+
@apply h-fit dark:bg-neutral-900;
167+
168+
.navbar-sidebar__item.menu {
169+
padding: 10px 6px !important;
170+
}
171+
172+
.color-mode-toggle {
173+
@apply absolute top-[21px] right-6 h-fit;
174+
}
175+
176+
.menu__link--sublist::after {
177+
content: none;
178+
}
179+
}
180+
181+
.navbar-sidebar__backdrop {
182+
@apply h-screen;
183+
}
184+
159185
.DocSearch-Button {
160-
@apply h-8 w-80 rounded-lg bg-neutral-100 font-normal text-neutral-500 hover:bg-neutral-200 hover:text-neutral-500 hover:shadow-none dark:bg-neutral-800/50 dark:hover:bg-neutral-800/80;
186+
@apply mr-6 h-8 scale-110 rounded-lg bg-transparent font-normal text-neutral-500 hover:bg-neutral-200 hover:text-neutral-500 hover:shadow-none md:scale-100 md:bg-neutral-100 md:text-neutral-500 lg:mr-0 lg:w-80 dark:bg-transparent dark:text-neutral-400 dark:hover:bg-neutral-800/80 dark:md:bg-neutral-800/50;
161187
font-family: Jost;
162188

163189
svg {
164-
@apply w-4 text-neutral-500;
190+
@apply w-4 text-current;
165191
}
166192

167193
.DocSearch-Button-Key {
@@ -180,7 +206,7 @@ html[data-theme-override="light"] {
180206
}
181207

182208
.navbar__link {
183-
@apply flex items-center font-medium text-neutral-600 after:border-t-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300;
209+
@apply hidden items-center font-medium text-neutral-600 after:border-t-neutral-600 lg:flex dark:text-neutral-400 dark:hover:text-neutral-300;
184210

185211
svg {
186212
display: inline;

src/theme/ColorModeToggle/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function ColorModeToggle({ className, buttonClassName, onChange }: Props): JSX.E
159159
className={clsx(
160160
styles.toggle,
161161
className,
162-
"text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300",
162+
"color-mode-toggle text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300",
163163
)}
164164
>
165165
<button

src/theme/Icon/Close/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
import type { Props } from "@theme/Icon/Close";
3+
import { Xmark } from "@gravity-ui/icons";
4+
5+
export default function IconClose({
6+
width = 21,
7+
height = 21,
8+
className,
9+
...restProps
10+
}: Props): JSX.Element {
11+
return (
12+
<Xmark
13+
className={className}
14+
viewBox="0 0 15 15"
15+
width={width}
16+
height={height}
17+
{...restProps}
18+
color="currentColor"
19+
/>
20+
);
21+
}

src/theme/Navbar/Logo/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Link from "@docusaurus/Link";
55

66
export default function NavbarLogo(): JSX.Element {
77
return (
8-
<div className="flex bg-white dark:bg-neutral-950">
8+
<div className="flex">
99
<TestplaneLogo className="h-8 w-8 dark:hidden" />
1010
<TestplaneLogoDark className="hidden h-8 w-8 dark:block" />
1111
<Link
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
import { useNavbarMobileSidebar } from "@docusaurus/theme-common/internal";
3+
import { translate } from "@docusaurus/Translate";
4+
import { EllipsisVertical } from "@gravity-ui/icons";
5+
6+
export default function MobileSidebarToggle(): JSX.Element {
7+
const { toggle, shown } = useNavbarMobileSidebar();
8+
return (
9+
<button
10+
onClick={toggle}
11+
aria-label={translate({
12+
id: "theme.docs.sidebar.toggleSidebarButtonAriaLabel",
13+
message: "Toggle navigation bar",
14+
description: "The ARIA label for hamburger menu button of mobile navigation",
15+
})}
16+
aria-expanded={shown}
17+
className="navbar__toggle clean-btn absolute right-2 z-999"
18+
type="button"
19+
>
20+
<EllipsisVertical />
21+
</button>
22+
);
23+
}

0 commit comments

Comments
 (0)