Skip to content

Commit 1d2461e

Browse files
authored
Merge pull request #3177 from Blargian/fix_top_level_menu
Fix menu overflow
2 parents bb038ac + 0002151 commit 1d2461e

File tree

8 files changed

+166
-35
lines changed

8 files changed

+166
-35
lines changed

src/components/ColorModeToggler/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function ColorModeToggle({className = ''}) {
2525
<path d="M8.7227 0.724664C8.7227 0.330045 8.39191 0 8.0036 0C7.60809 0 7.2773 0.330045 7.2773 0.724664V2.18834C7.2773 2.57578 7.60809 2.90583 8.0036 2.90583C8.39191 2.90583 8.7227 2.57578 8.7227 2.18834V0.724664ZM11.5991 3.4009C11.3258 3.67354 11.3258 4.13274 11.6063 4.41256C11.8796 4.6852 12.347 4.69238 12.6274 4.40538L13.6629 3.3722C13.9434 3.09238 13.9362 2.62601 13.6629 2.34619C13.3897 2.07354 12.9222 2.08072 12.649 2.35336L11.5991 3.4009ZM3.37258 4.40538C3.64584 4.6852 4.11326 4.6852 4.38652 4.41256C4.66697 4.14709 4.66697 3.66637 4.4009 3.4009L3.3582 2.35336C3.09213 2.08789 2.61753 2.07354 2.34427 2.34619C2.07101 2.62601 2.06382 3.09238 2.33708 3.36502L3.37258 4.40538ZM7.9964 11.774C10.0602 11.774 11.7717 10.0664 11.7717 8C11.7717 5.93363 10.0602 4.22601 7.9964 4.22601C5.93258 4.22601 4.22112 5.93363 4.22112 8C4.22112 10.0664 5.93258 11.774 7.9964 11.774ZM7.9964 10.4395C6.65888 10.4395 5.55146 9.33453 5.55146 8C5.55146 6.66547 6.65888 5.56054 7.9964 5.56054C9.33393 5.56054 10.4413 6.66547 10.4413 8C10.4413 9.33453 9.33393 10.4395 7.9964 10.4395ZM15.2809 8.71749C15.6692 8.71749 16 8.38744 16 8C16 7.60538 15.6692 7.28251 15.2809 7.28251H13.8211C13.4328 7.28251 13.102 7.60538 13.102 8C13.102 8.38744 13.4328 8.71749 13.8211 8.71749H15.2809ZM0.719101 7.28251C0.330787 7.28251 0 7.60538 0 8C0 8.38744 0.330787 8.71749 0.719101 8.71749H2.17888C2.57438 8.71749 2.90517 8.38744 2.90517 8C2.90517 7.60538 2.57438 7.28251 2.17888 7.28251H0.719101ZM12.6202 11.5946C12.347 11.322 11.8796 11.322 11.5991 11.5946C11.3258 11.8744 11.3258 12.3336 11.6063 12.6135L12.649 13.6538C12.9294 13.9265 13.3897 13.9193 13.6701 13.6395C13.9434 13.3668 13.9434 12.9076 13.6629 12.6278L12.6202 11.5946ZM2.33708 12.6206C2.05663 12.9004 2.05663 13.3668 2.3227 13.6395C2.60315 13.9121 3.07056 13.9193 3.34382 13.6466L4.38652 12.6135C4.66697 12.3336 4.66697 11.8744 4.4009 11.6018C4.12045 11.322 3.65303 11.322 3.37258 11.5946L2.33708 12.6206ZM8.7227 13.8117C8.7227 13.4242 8.39191 13.0942 8.0036 13.0942C7.60809 13.0942 7.2773 13.4242 7.2773 13.8117V15.2753C7.2773 15.6628 7.60809 16 8.0036 16C8.39191 16 8.7227 15.6628 8.7227 15.2753V13.8117Z" fill="currentColor"/>
2626
</svg>
2727
)}
28-
<span>{`${colorMode} Mode`}</span>
28+
<div><span>{`${colorMode}`}</span><span className={styles.themeModeText}> Mode</span></div>
2929
</button>
3030
);
3131
}

src/components/ColorModeToggler/styles.module.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
align-items: center;
44
cursor: pointer;
55
border: 1px solid rgba(0, 0, 0, 0.1);
6-
padding: 8px;
6+
padding: 2px;
77
gap: 8px;
88
color: var(--click-color-secondary-button-text);
99
border: 0;
@@ -19,3 +19,20 @@
1919
white-space: nowrap;
2020
}
2121

22+
@media (max-width: 1100px) {
23+
.themeModeText {
24+
display: none;
25+
}
26+
}
27+
28+
@media (max-width: 997px) {
29+
.themeModeText {
30+
display: block;
31+
}
32+
33+
.colorModeWrapper {
34+
display: flex;
35+
gap: 0.3rem;
36+
}
37+
}
38+

src/components/DocsCategoryDropdown/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function DocsCategoryDropdown({ dropdownCategory }) {
9090
export const DocsCategoryDropdownLinkOnly = ({ title, link }) => {
9191
return (
9292
<div className={styles.docsNavDropdownContainer}>
93-
<Link href={link} className={styles.docsNavDropdownToolbarTopLevelLink}>{title}</Link>
93+
<Link href={link} className={styles.docsNavDropdownToolbarTopLevelLink}><span>{title}</span></Link>
9494
</div>
9595
);
9696
}

src/components/DocsCategoryDropdown/styles.module.css

Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
.docsNavDropdownContainer {
2+
padding: 8px;
3+
border-radius: 10px;
24
position: relative;
35
display: inline-block;
6+
color: var(--ch-nav-v2-link-color);
7+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
8+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
9+
transition-duration: 150ms;
10+
11+
&:hover,
12+
&.hover {
13+
background-color: var(--ch-nav-v2-link-hover-bg);
14+
text-decoration: none;
15+
color: #FAFF69;
16+
}
417
}
518

19+
.docsNavDropdownContainer::after {
20+
content: "";
21+
position: absolute;
22+
left: 0;
23+
bottom: -30px; /* Adjust this for the hover area extension */
24+
width: 100%;
25+
height: 30px; /* Must match the bottom value */
26+
pointer-events: auto;
27+
}
28+
29+
630
.docsNavDropdownToolbarLink, .docsNavDropdownToolbarTopLevelLink {
731
font-weight: bold;
8-
font-size: 14px;
32+
font-size: 0.875rem;
933
cursor: default;
1034
color: #414040;
1135
color: black;
12-
margin-right: 30px;
1336
}
1437

1538
.docsNavDropdownToolbarLink:hover {
@@ -30,7 +53,7 @@
3053
}
3154

3255
[data-theme="dark"] .docsNavDropdownToolbarLink:hover, [data-theme="dark"] .docsNavDropdownToolbarTopLevelLink:hover {
33-
color: white;
56+
color: #FAFF69;
3457
}
3558

3659
.docsNavSelected {
@@ -40,23 +63,26 @@
4063
}
4164

4265
[data-theme="dark"] .docsNavSelected {
43-
color: white;
66+
color: #FAFF69;
4467
text-decoration: underline;
4568
text-underline-offset: 4px;
4669
}
4770

4871
.docsNavDropdownMenu {
4972
position: absolute;
50-
top: 100%;
73+
top: calc(100% + 30px);
5174
left: 0;
5275
z-index: 9999 !important;
5376
min-width: 300px;
5477
max-width: 600px;
5578
background-color: white;
5679
border: 1px solid var(--click-color-stroke);
5780
filter: drop-shadow(0px 2px 2px rgba(50, 50, 50, 0.1));
58-
padding: 15px 10px 20px 10px;
59-
border-radius: 4px;
81+
padding: 10px 10px 10px 10px;
82+
border-radius: 10px;
83+
opacity: 1;
84+
transition: opacity 0.3s ease-in-out;
85+
transform: translateY(30px);
6086
}
6187

6288
@media (max-width: 768px) {
@@ -84,23 +110,27 @@
84110

85111
[data-theme="dark"] .docsNavDropdownMenu {
86112
color: white;
87-
background-color: #282828;
113+
background-color: #1F1F1C;
88114
border: 1px solid #4B4B4B;
89115
filter: drop-shadow(0px 10px 6px rgba(0, 0, 0, 0.5));
90116
}
91117

118+
[data-theme="light"] .docsNavDropdownMenu {
119+
color: black;
120+
}
121+
92122
.docsNavMenuHeader {
93-
color: var(--ifm-toc-link-color);
94-
margin-left: 10px;
95-
font-size: 14px;
123+
font-size: 0.875rem;
96124
font-weight: bold;
97125
}
98126

127+
[data-theme="light"] .docsNavMenuHeader {
128+
color: black;
129+
}
130+
131+
99132
.docsNavMenuDescription {
100-
margin-top: 5px;
101-
margin-bottom: 10px;
102-
margin-left: 10px;
103-
font-size: 14px;
133+
font-size: 0.75rem;
104134
color: var(--ifm-toc-link-color);
105135
}
106136

@@ -112,7 +142,6 @@
112142
border-top: 1px solid var(--click-color-stroke);
113143
width: 100%;
114144
margin: 0;
115-
margin-top: 10px;
116145
margin-bottom: 5px;
117146
}
118147

@@ -122,13 +151,12 @@
122151

123152
.docsNavMenuItems {
124153
display: grid;
125-
grid-template-columns: 1fr 1fr;
126-
gap: 10px;
154+
grid-template-columns: 1fr;
127155
width: 100%;
128156
}
129157

130158
.docsNavMenuItem {
131-
padding: 10px;
159+
padding: 8px;
132160
max-width: 100%;
133161
word-wrap: break-word;
134162
word-break: break-word;
@@ -143,24 +171,23 @@
143171
}
144172

145173
[data-theme="dark"] .docsNavHovered {
146-
background-color: #3a3a3a;
174+
background-color: #1F1F1C;
147175
}
148176

149177
.docsNavItemTitle {
150-
font-size: 14px;
178+
font-size: 0.875rem;
151179
color: black;
152180
font-weight: bold;
153181
}
154182

155183
[data-theme="dark"] .docsNavItemTitle {
156-
font-size: 14px;
184+
font-size: 0.875rem;
157185
color: #FCFF74;
158186
}
159187

160188
.docsNavItemDescription {
161189
color: var(--ifm-toc-link-color);
162-
font-size: 14px;
163-
margin-top: 4px;
190+
font-size: 0.75rem;
164191
}
165192

166193
[data-theme="dark"] .docsNavItemDescription {
@@ -170,3 +197,18 @@
170197
[data-theme="dark"] .docsNavMenuItem:hover .docsNavItemDescription {
171198
color: white;
172199
}
200+
201+
@media screen and (max-width: 1100px) {
202+
.docsNavDropdownContainer {
203+
padding: 0px;
204+
}
205+
206+
[data-theme="dark"] .docsNavDropdownContainer {
207+
background-color: #201c1c;
208+
}
209+
210+
[data-theme="light"] .docsNavDropdownContainer {
211+
background-color: white;
212+
}
213+
}
214+

src/components/Navigation/styles.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,22 @@ ul.ch-nav-v2-sub-nav-resources {
404404
.ch-nav-v2-sub-nav-use-cases {
405405

406406
}
407+
408+
@media screen and (max-width: 1100px) {
409+
.ch-nav-v2-item > a{
410+
padding: 0px;
411+
}
412+
413+
[data-theme="dark"] .ch-nav-v2-item > a {
414+
background-color: #201c1c;
415+
}
416+
417+
[data-theme="light"] .ch-nav-v2-item > a {
418+
background-color: white;
419+
}
420+
421+
.click-button {
422+
padding: 8px;
423+
}
424+
}
425+

src/css/custom.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ img {
868868
}
869869

870870
.dropdown {
871+
871872
& > .navbar__link:after {
872873
border: none;
873874
background: var(--ifm-menu-link-sublist-icon);
@@ -884,6 +885,13 @@ img {
884885
}
885886
}
886887

888+
@media screen and (max-width: 1100px) {
889+
.dropdown {
890+
padding-right: 2px;
891+
padding-left: 20px;
892+
}
893+
}
894+
887895
.markdown {
888896
table {
889897
border-radius: 4px;
@@ -1254,6 +1262,19 @@ input::-ms-input-placeholder { /* Microsoft Edge */
12541262
}
12551263
}
12561264

1265+
/* Fixes for the long menu bar */
1266+
@media (max-width: 1250px) {
1267+
1268+
.docsNavDropdownContainer_cADf a[href="/docs/knowledgebase"]::before {
1269+
content: "KB";
1270+
display: inline-block;
1271+
}
1272+
1273+
.docsNavDropdownContainer_cADf a[href="/docs/knowledgebase"] span{
1274+
display: none;
1275+
}
1276+
}
1277+
12571278
.blog-list-page .margin-bottom--xl, .blog-tags-post-list-page .margin-bottom--xl {
12581279
margin-bottom: 1rem !important;
12591280
}

src/theme/Navbar/Content/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function NavbarItems({ items }) {
4040
// TODO: Move this to a config file
4141
// Important note: The link is either the slug (iff one is set) or the file path.
4242
const dropdownCategories = [{
43-
title: 'Getting Started',
43+
title: 'Get Started',
4444
description: 'Learn how to use ClickHouse',
4545
sidebar: 'docs',
4646
link: '/docs',
@@ -122,7 +122,7 @@ const dropdownCategories = [{
122122
]
123123
},
124124
{
125-
title: 'Managing Data',
125+
title: 'Manage Data',
126126
description: 'How to manage data in ClickHouse',
127127
sidebar: 'managingData',
128128
link: '/docs/en/updating-data',
@@ -188,7 +188,7 @@ const dropdownCategories = [{
188188
]
189189
},
190190
{
191-
title: 'SQL Reference',
191+
title: 'Reference',
192192
description: 'Reference documentation for ClickHouse features',
193193
sidebar: 'sqlreference',
194194
link: '/docs/en/sql-reference',

0 commit comments

Comments
 (0)