Skip to content

Commit 598c837

Browse files
committed
swizzle desktop sidebar
1 parent 11523bd commit 598c837

File tree

3 files changed

+106
-6
lines changed

3 files changed

+106
-6
lines changed

docusaurus.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,6 @@ const config = {
257257
label: "What's new?",
258258
position: 'right',
259259
},
260-
{
261-
type: "docsVersionDropdown",
262-
position: "right",
263-
docsPluginId: "gator",
264-
dropdownActiveClassDisabled: true,
265-
},
266260
{
267261
type: 'custom-navbarWallet',
268262
position: 'right',
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React, {type ReactNode} from 'react';
2+
import Content from '@theme-original/DocSidebar/Desktop/Content';
3+
import type ContentType from '@theme/DocSidebar/Desktop/Content';
4+
import type {WrapperProps} from '@docusaurus/types';
5+
import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
6+
import styles from './styles.module.css';
7+
8+
type Props = WrapperProps<typeof ContentType>;
9+
10+
export default function ContentWrapper(props: Props): ReactNode {
11+
return (
12+
<div className={styles.sidebarWithVersionDropdown}>
13+
<div className={styles.versionDropdownContainer}>
14+
<DocsVersionDropdownNavbarItem
15+
docsPluginId="gator" // Use your plugin ID if different
16+
dropdownActiveClassDisabled={false}
17+
dropdownItemsBefore={[]}
18+
dropdownItemsAfter={[]}
19+
/>
20+
</div>
21+
<Content {...props} />
22+
</div>
23+
);
24+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
.sidebarWithVersionDropdown {
2+
display: flex;
3+
flex-direction: column;
4+
height: 100%;
5+
}
6+
7+
.versionDropdownContainer {
8+
padding: 1.4rem 3.2rem 1.4rem 2.4rem;
9+
border-bottom: 1px solid var(--ifm-color-emphasis-200);
10+
}
11+
12+
/* Style adjustments for the dropdown in sidebar context */
13+
.versionDropdownContainer :global(.navbar__item) {
14+
display: block;
15+
padding: 0;
16+
}
17+
18+
/* Ensure the dropdown button looks good in the sidebar */
19+
.versionDropdownContainer :global(.navbar__link) {
20+
display: flex;
21+
justify-content: space-between;
22+
width: 100%;
23+
font-size: 1.7rem;
24+
padding: 0.4rem 0;
25+
}
26+
27+
/* Adjust the dropdown arrow position */
28+
.versionDropdownContainer :global(.navbar__link:after) {
29+
margin-top: 1rem;
30+
}
31+
32+
/* Style dropdown menu */
33+
.versionDropdownContainer :global(.dropdown__menu) {
34+
width: 100%;
35+
max-height: 300px;
36+
overflow-y: auto;
37+
padding: 0.5rem 0;
38+
}
39+
40+
/* Style individual dropdown items */
41+
.versionDropdownContainer :global(.dropdown__link) {
42+
display: flex;
43+
align-items: center;
44+
justify-content: space-between;
45+
padding: 1.8rem 1rem;
46+
font-size: 1.6rem;
47+
font-weight: 500;
48+
color: var(--ifm-font-color-base);
49+
}
50+
51+
/* Style the active dropdown item */
52+
.versionDropdownContainer :global(.dropdown__link--active) {
53+
background-color: var(--ifm-color-emphasis-100);
54+
color: var(--ifm-color-primary);
55+
}
56+
57+
/* Style dropdown items on hover */
58+
.versionDropdownContainer :global(.dropdown__link:hover) {
59+
background-color: var(--ifm-color-emphasis-200);
60+
text-decoration: none;
61+
}
62+
63+
/* Add a small delay before closing the dropdown */
64+
.versionDropdownContainer :global(.dropdown) {
65+
transition-delay: 0s;
66+
}
67+
68+
.versionDropdownContainer :global(.dropdown--show) {
69+
transition-delay: 0s;
70+
}
71+
72+
.versionDropdownContainer :global(.dropdown--show .dropdown__menu) {
73+
opacity: 1;
74+
visibility: visible;
75+
transition: opacity 0.2s ease, visibility 0.2s ease;
76+
}
77+
78+
/* Create a "safe area" between button and dropdown */
79+
.versionDropdownContainer :global(.dropdown__menu) {
80+
margin-top: -5px; /* Negative margin to create overlap */
81+
padding-top: 5px; /* Add padding at the top to maintain visual spacing */
82+
}

0 commit comments

Comments
 (0)