import {css} from "@linaria/core"; // TODO: in the futre better media queries const tabletBreakpoint = '1024px'; const mobileBreakpoint = '768px'; export const LayoutPrimaryHost = css` @layer defaults { width: 100%; overflow-x: hidden; background: var(--xyd-page-body-bgcolor); display: contents; > [part="header"] { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; right: var(--xyd-page-gutter); left: var(--xyd-page-gutter); height: var(--xyd-nav-height); background: var(--xyd-layout-header-bgcolor); z-index: 3; flex-direction: column; @media (max-width: ${mobileBreakpoint}) { padding: 0; } } &[data-hide-subheader="true"] > [part="header"] { transform: translateY(calc(-1 * var(--xyd-nav-height))); } &[data-hide-subheader="true"] > [part="header"] > [part="header-content"] { visibility: hidden; } &[data-subheader="true"] > [part="header"] { flex-direction: column; height: var(--xyd-header-total-height); transition: transform 200ms; } [part="header-content"] { display: flex; align-items: center; width: 100%; } [part="header-subheader"] { width: 100%; } [part="hamburger-button"] { display: none; @media (max-width: ${tabletBreakpoint}) { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: none; background: none; cursor: pointer; padding: 0; } } [part="hamburger-icon"] { width: 24px; height: 24px; position: relative; display: flex; flex-direction: column; justify-content: space-between; } [part="hamburger-line"] { width: 100%; height: 2px; background: var(--xyd-page-body-color); transition: transform 0.3s var(--xyd-cubic-bezier); &[data-active="true"] { &:first-child { transform: translateY(11px) rotate(45deg); } &:nth-child(2) { opacity: 0; } &:last-child { transform: translateY(-11px) rotate(-45deg); } } } [part="main"] { position: relative; display: flex; top: 0; bottom: 0; left: 0; right: 0; padding: var(--xyd-page-gutter); overflow: visible; min-height: calc(100vh - (var(--xyd-nav-height) + var(--xyd-banner-height))) } [part="sidebar"] { flex: none; width: var(--xyd-sidebar-width); background: var(--xyd-layout-sidebar-bgcolor); display: flex; flex-direction: column; position: relative; height: 100%; @media (max-width: ${tabletBreakpoint}) { display: none; } } [part="mobile-sidebar"] { display: none; @media (max-width: ${tabletBreakpoint}) { display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: var(--xyd-sidebar-width--mobile); background: var(--xyd-layout-sidebar-bgcolor); flex-direction: column; z-index: 50; transform: translateX(-100%); transition: transform .3s var(--xyd-cubic-bezier); box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1); } &[data-active="true"] { @media (max-width: ${tabletBreakpoint}) { transform: translateX(0); } } } [part="mobile-sidebar-aside"] { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; height: 100%; } [part="mobile-sidebar-close-button"] { align-items: center; background: none; border: none; cursor: pointer; display: flex; height: 32px; justify-content: center; padding: 0; position: absolute; right: -3px; top: 0px; width: 32px; z-index: 10; } [part="mobile-sidebar-close-icon"] { width: 20px; height: 20px; position: relative; &::before, &::after { content: ''; position: absolute; top: 50%; left: 0; width: 100%; height: 2px; background: var(--xyd-page-body-color--secondary); transform-origin: center; } &::before { transform: rotate(45deg); } &::after { transform: rotate(-45deg); } } [part="mobile-overlay"] { display: none; @media (max-width: ${tabletBreakpoint}) { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, 0.6); transition: opacity .3s; opacity: 0; pointer-events: none; z-index: 40; height: 100vh; } &[data-active="true"] { opacity: 1; pointer-events: auto; } } [part="page"] { position: relative; overflow: visible; flex: 1; background: var(--xyd-page-body-bgcolor); min-width: 0; height: 100%; } [part="page-scroll"] { overflow-y: visible; height: 100%; -webkit-overflow-scrolling: touch; padding: 0 48px; @media (max-width: ${tabletBreakpoint}) { padding: 0 32px; } @media (max-width: ${mobileBreakpoint}) { padding: 0 24px; } } &[data-layout="wide"] [part="page-scroll"] { padding-top: 15px; } [part="page-container"] { max-width: var(--xyd-layout-width-medium); margin: 0 auto; padding: 0 var(--xyd-page-gutter); height: 100%; } &[data-layout="wide"] [part="page-container"] { max-width: var(--xyd-layout-width-large); } [part="page-article-container"] { display: flex; gap: 48px; padding: 48px 0; min-height: 100%; @media (max-width: ${tabletBreakpoint}) { gap: 32px; } @media (max-width: ${mobileBreakpoint}) { flex-direction: column; padding: 24px 0; gap: 24px; } } [part="page-article"] { flex: 1; min-width: 0; } [part="page-article-content"] { width: 100%; } [part="page-article-nav"] { --page-article-nav-top: calc(var(--xyd-header-total-height) / 2); display: flex; flex: none; flex-direction: column; gap: 16px; width: var(--xyd-layout-nav-width-medium); position: sticky; height: fit-content; max-height: 100vh; overflow-y: auto; padding-right: 24px; padding: var(--xyd-content-space) 0; margin-top: var(--page-article-nav-top); top: calc(var(--xyd-header-total-height) + var(--page-article-nav-top)); /* top: var(--xyd-header-total-height); */ @media (max-width: ${tabletBreakpoint}) { width: var(--xyd-layout-nav-width-small); padding-right: 16px; } @media (max-width: ${mobileBreakpoint}) { display: none; } } } @layer defaultfix { > [part="header"]:has(xyd-banner) { height: auto; } } `;