Skip to content

Commit a0aafa5

Browse files
committed
chore: update navscreen
1 parent fa3ef00 commit a0aafa5

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

packages/core/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
<body>
1212
<div id="__rspress_root"><!--<?- DOC_CONTENT ?>--></div>
13-
<div id="__rspress_search_container"></div>
13+
<div id="__rspress_modal_container"></div>
1414
</body>
1515
</html>
Lines changed: 5 additions & 1 deletion
Loading

packages/theme-default/src/components/NavHamburger/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import SmallMenu from '@theme-assets/small-menu';
2+
import { createPortal } from 'react-dom';
23
import { NavScreen } from '../NavScreen';
34
import { SvgWrapper } from '../SvgWrapper';
45
import * as styles from './index.module.scss';
@@ -8,15 +9,22 @@ export function NavHamburger() {
89
const { isScreenOpen, toggleScreen } = useNavScreen();
910
return (
1011
<>
11-
<NavScreen isScreenOpen={isScreenOpen} toggleScreen={toggleScreen} />
12+
{createPortal(
13+
<NavScreen isScreenOpen={isScreenOpen} toggleScreen={toggleScreen} />,
14+
document.getElementById('__rspress_modal_container')!,
15+
)}
1216
<button
1317
onClick={toggleScreen}
1418
aria-label="mobile hamburger"
1519
className={`${isScreenOpen ? styles.active : ''} rspress-mobile-hamburger ${
1620
styles.navHamburger
1721
} rp-text-gray-500`}
1822
>
19-
<SvgWrapper icon={SmallMenu} fill="currentColor" />
23+
<SvgWrapper
24+
icon={SmallMenu}
25+
fill="currentColor"
26+
className={`${isScreenOpen ? 'rp-bg-gray-200' : 'hover:rp-bg-gray-100'}`}
27+
/>
2028
</button>
2129
</>
2230
);

packages/theme-default/src/components/NavScreen/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
background-color: var(--rp-c-bg);
1111
overflow-y: auto;
1212
pointer-events: auto;
13-
z-index: 20;
13+
z-index: var(--rp-z-index-nav-screen);
1414
}
1515
.active {
1616
display: block;

packages/theme-default/src/components/Search/SearchPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
550550
) : null}
551551
</div>
552552
</div>,
553-
document.getElementById('__rspress_search_container')!,
553+
document.getElementById('__rspress_modal_container')!,
554554
)}
555555
</>
556556
);

packages/theme-default/src/layout/DocLayout/index.scss

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
:root {
22
// z-index
3+
--rp-z-index-nav-screen: 80;
34
--rp-z-index-nav-menu: 30;
45
--rp-z-index-nav: 50;
5-
--rp-z-index-mask: 60;
6-
--rp-z-index-sidebar: 70;
6+
--rp-z-index-mask: 70;
7+
--rp-z-index-sidebar: 60;
78
--rp-z-index-aside: 40;
89
}
910

@@ -70,7 +71,7 @@
7071

7172
// postion
7273
position: sticky;
73-
// margin-top: calc(-1 * var(--rp-sidebar-menu-height));
74+
margin-top: calc(-1 * var(--rp-sidebar-menu-height));
7475
top: var(--rp-nav-height);
7576
left: 0;
7677
bottom: 0;
@@ -177,7 +178,7 @@
177178
}
178179
}
179180

180-
@media (max-width: 960px) {
181+
@media (max-width: 768px) {
181182
:root {
182183
--rp-content-padding-x: 24px;
183184
}
@@ -186,12 +187,9 @@
186187
z-index: var(--rp-z-index-sidebar);
187188
position: fixed;
188189
top: var(--rp-nav-height);
189-
right: 0;
190190

191-
// margin-top: var(--rp-sidebar-menu-height);
192-
height: calc(
193-
100vh - var(--rp-nav-height) - var(--rp-sidebar-menu-height)
194-
);
191+
margin-top: 0px;
192+
height: calc(100vh - var(--rp-nav-height));
195193

196194
padding: var(--rp-sidebar-padding) var(--rp-sidebar-padding)
197195
calc(var(--rp-sidebar-padding) + 100px) var(--rp-sidebar-padding);

0 commit comments

Comments
 (0)