Skip to content

Commit 65afc5f

Browse files
chore(project): update navbar
1 parent b25c1ed commit 65afc5f

File tree

4 files changed

+1118
-231
lines changed

4 files changed

+1118
-231
lines changed

@theme/components/Navbar/Navbar.tsx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ProductPicker } from '@redocly/theme/components/Product/ProductPicker';
1414
import { Button } from '@redocly/theme/components/Button/Button';
1515
import { CloseIcon } from '@redocly/theme/icons/CloseIcon/CloseIcon';
1616
import { Search } from '@redocly/theme/components/Search/Search';
17+
import { Banner } from '@redocly/theme/components/Banner/Banner';
1718

1819
import { MenuIcon } from '@redocly/marketing-pages/icons/MenuIcon.js';
1920
import { TextSmall } from '@redocly/marketing-pages/components/TypographyElements/TypographyElements.js';
@@ -112,6 +113,7 @@ export function Navbar({ className }: NavbarProps): JSX.Element | null {
112113
isMobile={isOpen}
113114
isRespect={pathname === '/respect'}
114115
>
116+
{!showVSCodeExtensionBanner && <Banner />}
115117
{showVSCodeExtensionBanner && <VSCodeExtensionBanner />}
116118
{isOpen && <MenuMobile />}
117119
<NavbarRow>
@@ -329,12 +331,17 @@ export const NavbarRow = styled.div`
329331
align-items: center;
330332
justify-content: space-between;
331333
width: 100%;
332-
333-
gap: var(--navbar-menu-items-gap);
334+
gap: var(--navbar-menu-items-gap);;
335+
height: var(--navbar-height);
334336
max-width: var(--navbar-container-max-width);
337+
margin-top: var(--banner-height);
338+
padding: 16px;
339+
transition: margin-top 0.4s ease-out;
335340
336-
@media screen and (min-width: ${breakpoints.large}) {
337-
margin: 0 auto;
341+
@media screen and (min-width: ${breakpoints.max}) {
342+
max-width: var(--container-max-width);
343+
margin-left: auto;
344+
margin-right: auto;
338345
}
339346
`;
340347

@@ -351,29 +358,33 @@ const NavbarContainer = styled.nav<{
351358
transition:
352359
border-color 0.3s ease-in-out,
353360
background 0.3s ease-in-out,
354-
transform 0.3s ease-in-out;
361+
transform 0.3s ease-in-out,
362+
height 0.4s ease-out;
355363
356364
${({ isDocs }) =>
357365
!isDocs &&
358366
css`
359367
transform: ${(isVisible) =>
360-
isVisible ? 'translateY(0)' : 'translateY(calc(var(--navbar-height) * -1))'};
368+
isVisible
369+
? 'translateY(0)'
370+
: 'translateY(calc((var(--navbar-height) + var(--banner-height)) * -1))'};
361371
`};
362372
border-bottom: 1px solid transparent;
363373
width: 100vw;
364374
--text-color: var(--navbar-text-color);
365375
box-sizing: border-box;
366376
display: flex;
367-
align-items: center;
377+
flex-direction: column;
378+
align-items: stretch;
368379
flex-shrink: 0;
369-
height: var(--navbar-height);
380+
height: calc(var(--navbar-height) + var(--banner-height));
370381
backdrop-filter: ${({ isTop, isDefault }) => isDefault && (isTop ? 'none' : 'blur(6px)')};
371382
372383
font-size: var(--navbar-font-size);
373384
position: sticky;
374385
top: 0;
375386
z-index: var(--z-index-raised);
376-
padding: 16px;
387+
padding: 0;
377388
background: ${({ isTop, isColorful, isDefault, isMobile, isRespect }) =>
378389
isRespect
379390
? 'var(--color-warm-grey-1)'
@@ -399,15 +410,13 @@ const NavbarContainer = styled.nav<{
399410
}
400411
401412
@media screen and (min-width: ${breakpoints.medium}) {
402-
padding: ${({ showVSCodeExtensionBanner }) =>
403-
showVSCodeExtensionBanner ? '0' : 'var(--navbar-padding)'};
404413
border-bottom: ${({ isTop, isDocs }) =>
405414
(!isTop || isDocs) && '1px solid var(--color-warm-grey-3)'};
406-
flex-direction: ${({ showVSCodeExtensionBanner }) => showVSCodeExtensionBanner && 'column'};
407415
height: ${({ showVSCodeExtensionBanner }) => showVSCodeExtensionBanner && 'auto'};
408416
409417
${NavbarRow} {
410-
padding: ${({ showVSCodeExtensionBanner }) => showVSCodeExtensionBanner && '0 40px'};
418+
padding: ${({ showVSCodeExtensionBanner }) =>
419+
showVSCodeExtensionBanner ? '0 40px' : 'var(--navbar-padding)'};
411420
}
412421
}
413422
`;

0 commit comments

Comments
 (0)