Skip to content

Commit 8a55fab

Browse files
authored
sidebar-v2 (#2555)
1 parent dadc137 commit 8a55fab

File tree

19 files changed

+669
-457
lines changed

19 files changed

+669
-457
lines changed

src/components/CCIP/Chain/Chain.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const searchLanes = getSearchLanes({ environment })
9090
<style scoped="false">
9191
.layout {
9292
--gutter: var(--space-10x);
93-
--doc-padding: var(--space-6x);
93+
--doc-padding: var(--space-4x);
9494
margin: var(--space-8x) auto;
9595
display: flex;
9696
flex-direction: column;
@@ -126,7 +126,7 @@ const searchLanes = getSearchLanes({ environment })
126126

127127
@media (min-width: 50em) {
128128
.layout {
129-
max-width: min(calc(1440px - 2 * var(--space-16x)), calc(100% - 2 * var(--space-16x)));
129+
max-width: min(calc(1440px - 2 * var(--space-4x)), calc(100% - 2 * var(--space-4x)));
130130
padding: 0;
131131
}
132132
}

src/components/DocsNavigation/DocsNavigationDesktop/docsNavigationDesktop.module.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
display: flex;
2222
justify-content: space-between;
2323
align-items: center;
24-
margin: auto;
25-
max-width: min(calc(1440px - 2 * var(--space-16x)), calc(100% - 2 * var(--space-16x)));
24+
margin: 0 auto;
25+
max-width: min(calc(1505px - 2 * var(--space-4x)), calc(100% - 2 * var(--space-4x)));
26+
padding: 0 var(--space-4x);
27+
width: 100%;
2628
}
2729

2830
.left {

src/components/DocsNavigation/DocsNavigationMobile/Category.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ const Item = React.forwardRef<HTMLAnchorElement, ListItemProps>(
5151
{itemComponent}
5252
</button>
5353
) : (
54-
<a className={clsx(styles.link, "product-link")} href={href} ref={forwardedRef}>
54+
<a
55+
className={clsx(styles.link, "product-link")}
56+
href={href.startsWith("http") ? href : `/${href}`}
57+
ref={forwardedRef}
58+
>
5559
{itemComponent}
5660
</a>
5761
)

src/components/DocsNavigation/DocsNavigationMobile/SubProductContent.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ type Props = {
1212
currentPath: string
1313
}
1414

15-
const renderPages = (pages: Page[], currentPath: string, indent: boolean) => {
15+
const renderPages = (pages: Page[], currentPath: string, level = 0) => {
1616
return pages.map(({ label, href, children }) => {
17-
const adjustedHref = "/" + href
17+
const adjustedHref = href.startsWith("http") ? href : `/${href}`
1818
const isActive = currentPath.replace(/\/$/, "") === adjustedHref.replace(/\/$/, "")
1919

2020
const linkRef = useRef<HTMLAnchorElement>(null)
@@ -29,15 +29,19 @@ const renderPages = (pages: Page[], currentPath: string, indent: boolean) => {
2929
backgroundColor: isActive ? "var(--blue-100)" : "transparent",
3030
color: isActive ? "var(--blue-600)" : "inherit",
3131
fontWeight: isActive ? "500" : "normal",
32-
marginLeft: indent ? "20px" : "0",
3332
}
3433

3534
return (
3635
<React.Fragment key={label}>
37-
<a ref={linkRef} style={linkStyle} className={`${styles.link} subproduct-link`} href={adjustedHref}>
36+
<a
37+
ref={linkRef}
38+
style={linkStyle}
39+
className={`${styles.link} subproduct-link level-${level}`}
40+
href={adjustedHref}
41+
>
3842
{label}
3943
</a>
40-
{children && renderPages(children, currentPath, true)}
44+
{children && renderPages(children, currentPath, level + 1)}
4145
</React.Fragment>
4246
)
4347
})
@@ -57,7 +61,7 @@ export const SubProductContent = ({ subProducts, onSubproductClick, currentPath
5761
{subProducts.items.map(({ label, pages }) => (
5862
<div key={label}>
5963
<h3 className={styles.section}>{label}</h3>
60-
{pages && renderPages(pages, currentPath, false)}
64+
{pages && renderPages(pages, currentPath, 1)}
6165
</div>
6266
))}
6367
</>

src/components/DocsNavigation/DocsNavigationMobile/docsNavigationMobile.module.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
display: flex;
2121
justify-content: space-between;
2222
align-items: center;
23-
margin: auto;
24-
max-width: calc(100% - 2 * var(--space-6x));
23+
max-width: 100%;
24+
padding: 0 var(--space-6x);
2525
height: var(--space-6x);
2626
}
2727

@@ -55,6 +55,10 @@
5555

5656
@media screen and (min-width: 768px) {
5757
.container {
58-
max-width: calc(100% - 2 * var(--space-8x));
58+
max-width: calc(100% - 2 * var(--space-6x));
59+
}
60+
.DocsPickerContainer {
61+
max-width: 100%;
62+
padding: 0 var(--space-6x);
5963
}
6064
}

src/components/DocsNavigation/DocsNavigationMobile/productNavigation.module.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,38 @@
8181
width: 100vw;
8282
padding-bottom: 56px;
8383
}
84+
85+
/* Nested level styles with margin-based indentation */
86+
.productContent :global(.level-1),
87+
.subProductContent :global(.level-1) {
88+
margin-left: var(--space-0x);
89+
}
90+
91+
.productContent :global(.level-2),
92+
.subProductContent :global(.level-2) {
93+
margin-left: var(--space-4x);
94+
}
95+
96+
.productContent :global(.level-3),
97+
.subProductContent :global(.level-3) {
98+
margin-left: var(--space-8x);
99+
}
100+
101+
.productContent :global(.level-4),
102+
.subProductContent :global(.level-4) {
103+
margin-left: var(--space-12x);
104+
}
105+
106+
.productContent :global(.level-5),
107+
.subProductContent :global(.level-5) {
108+
margin-left: var(--space-16x);
109+
}
110+
111+
.productContent :global(.level-6),
112+
.subProductContent :global(.level-6) {
113+
margin-left: var(--space-20x);
114+
}
115+
84116
.subProductContent {
85117
display: flex;
86118
flex-direction: column;

src/components/Header/Nav/navBar.module.css

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1+
/*
2+
* Navigation bar styles
3+
*
4+
* The navigation uses a fixed header with blur effect and contains:
5+
* 1. Logo section (left)
6+
* 2. Menu section (center)
7+
* 3. Right section with actions
8+
*
9+
* Responsive breakpoints:
10+
* - Mobile: < 992px
11+
* - Desktop: >= 992px
12+
*/
13+
114
.header {
215
position: absolute;
316
z-index: 10;
417
top: 0;
518
width: 100%;
619
}
720

21+
/* Main navigation bar with blur effect */
822
.navBar {
923
position: fixed;
1024
width: 100%;
@@ -16,18 +30,22 @@
1630
transition: transform 0.3s ease-in-out;
1731
}
1832

33+
/* Variant without shadow for special cases */
1934
.noShadow {
2035
box-shadow: none;
2136
border-bottom: none;
2237
}
2338

39+
/* Main content container with responsive width */
2440
.container {
25-
composes: container from global;
41+
max-width: min(calc(1505px - 2 * var(--space-4x)), calc(100% - 2 * var(--space-4x)));
42+
margin: 0 auto;
43+
padding: 0 var(--space-4x);
44+
width: 100%;
2645
position: relative;
2746
display: flex;
2847
justify-content: space-between;
2948
padding-block: var(--space-0x);
30-
width: auto;
3149
height: var(--space-16x);
3250
gap: var(--space-3x);
3351
}
@@ -38,7 +56,7 @@
3856
}
3957

4058
.isHomepage {
41-
max-width: calc(100% - 2 * var(--space-8x));
59+
max-width: min(1505px, calc(100% - 2 * var(--space-16x)));
4260
}
4361

4462
.headerHidden {
@@ -278,11 +296,12 @@
278296

279297
@media screen and (max-width: 992px) {
280298
.container {
299+
max-width: 100%;
300+
padding: 0 var(--space-6x);
281301
position: relative;
282302
display: flex;
283303
justify-content: space-between;
284304
align-items: center;
285-
padding-block: var(--space-4x);
286305
height: var(--space-16x);
287306
}
288307

@@ -308,7 +327,9 @@
308327
}
309328

310329
@media screen and (min-width: 72rem) {
311-
.isHomepage {
312-
max-width: min(1200px, calc(100% - 2 * var(--space-16x)));
330+
.container:not(.isHomepage) {
331+
max-width: min(calc(1505px - 2 * var(--space-4x)), calc(100% - 2 * var(--space-4x)));
332+
margin: 0 auto;
333+
padding: 0 var(--space-4x);
313334
}
314335
}

0 commit comments

Comments
 (0)