Skip to content

Commit f967628

Browse files
committed
chore: update
1 parent b57ea81 commit f967628

File tree

4 files changed

+46
-52
lines changed

4 files changed

+46
-52
lines changed

packages/theme-default/src/components/NewNav/index.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
border-bottom: 1px solid var(--rp-c-divider-light);
66
background: var(--rp-c-bg);
77
color: var(--rp-c-text-1);
8-
padding: 0 20px 0 20px;
8+
9+
--rp-nav-padding-x: 20px;
10+
padding: 0 var(--rp-nav-padding-x) 0 var(--rp-nav-padding-x);
11+
912
justify-content: space-between;
1013
align-items: center;
1114

packages/theme-default/src/components/SidebarMenu/index.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
.rspress-sidebar-menu-container {
2-
position: sticky;
3-
top: var(--rp-nav-height);
4-
left: 0;
5-
z-index: var(--rp-z-index-local-nav);
6-
}
7-
81
// Only appear on <1280px screen width
92
.rspress-sidebar-menu {
103
display: flex;

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

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -76,53 +76,49 @@ export function SidebarMenu({
7676

7777
return (
7878
<>
79-
<div
80-
className={`rspress-sidebar-menu-container ${hasToc ? '' : 'no-toc'}`}
81-
>
82-
<div className="rspress-sidebar-menu">
83-
{uiSwitch?.showSidebar && (
84-
<>
85-
<button
86-
type="button"
87-
onClick={openSidebar}
88-
className="rp-flex rp-items-center rp-justify-center rp-mr-auto"
89-
>
90-
<div className="rp-text-md rp-mr-2">
91-
<SvgWrapper icon={MenuIcon} />
92-
</div>
93-
<span className="rp-text-sm">Menu</span>
94-
</button>
95-
</>
96-
)}
97-
{uiSwitch?.showAside && hasToc && (
98-
<>
99-
<button
100-
type="button"
101-
onClick={() => setIsTocOpen(tocOpened => !tocOpened)}
102-
className="rp-flex rp-items-center rp-justify-center rp-ml-auto"
103-
ref={outlineButtonRef}
104-
>
105-
<span className="rp-text-sm">{outlineTitle}</span>
106-
<div
107-
className="rp-text-md rp-mr-2"
108-
style={{
109-
transform: isTocOpen ? 'rotate(90deg)' : 'rotate(0deg)',
110-
transition: 'transform 0.2s ease-out',
111-
marginTop: '2px',
112-
}}
113-
>
114-
<SvgWrapper icon={ArrowRight} />
115-
</div>
116-
</button>
117-
79+
<div className="rspress-sidebar-menu">
80+
{uiSwitch?.showSidebar && (
81+
<>
82+
<button
83+
type="button"
84+
onClick={openSidebar}
85+
className="rp-flex rp-items-center rp-justify-center rp-mr-auto"
86+
>
87+
<div className="rp-text-md rp-mr-2">
88+
<SvgWrapper icon={MenuIcon} />
89+
</div>
90+
<span className="rp-text-sm">Menu</span>
91+
</button>
92+
</>
93+
)}
94+
{uiSwitch?.showAside && hasToc && (
95+
<>
96+
<button
97+
type="button"
98+
onClick={() => setIsTocOpen(tocOpened => !tocOpened)}
99+
className="rp-flex rp-items-center rp-justify-center rp-ml-auto"
100+
ref={outlineButtonRef}
101+
>
102+
<span className="rp-text-sm">{outlineTitle}</span>
118103
<div
119-
className={`rspress-local-toc-container ${isTocOpen ? 'rspress-local-toc-container-show' : ''}`}
104+
className="rp-text-md rp-mr-2"
105+
style={{
106+
transform: isTocOpen ? 'rotate(90deg)' : 'rotate(0deg)',
107+
transition: 'transform 0.2s ease-out',
108+
marginTop: '2px',
109+
}}
120110
>
121-
<Toc onItemClick={toggleTocItem} />
111+
<SvgWrapper icon={ArrowRight} />
122112
</div>
123-
</>
124-
)}
125-
</div>
113+
</button>
114+
115+
<div
116+
className={`rspress-local-toc-container ${isTocOpen ? 'rspress-local-toc-container-show' : ''}`}
117+
>
118+
<Toc onItemClick={toggleTocItem} />
119+
</div>
120+
</>
121+
)}
126122
</div>
127123
{isSidebarOpen && (
128124
<div

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
@media (min-width: 1280px) {
8484
.rp-doc-layout__doc {
8585
max-width: min(100%, 1000px);
86+
overflow-x: auto; // CSS footgun: ensure right aside width is fixed
87+
flex: 1; // CSS footgun: ensure right aside width is fixed
8688
}
8789
.rp-doc-layout__sidebar {
8890
--rp-sidebar-margin-left: calc(

0 commit comments

Comments
 (0)