Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

5.7 KB
Raw Blame
.portal-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh; /* track mobile browser chrome */
  /* Matches the editor's sidebar: one solid panel with a rule on the content side. */
  background: var(--c-surface);
  border-inline-end: 1px solid var(--c-border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  /* Slide between the full rail and the collapsed icon rail. Overridden by the
     drawer's transform transition under the mobile breakpoint below. */
  transition: width var(--motion-spring);
}

@media (prefers-reduced-motion: reduce) {
  .portal-sidebar {
    transition: none;
  }
}

/* Nav labels stay on one line and are clipped by the narrowing rail so they
   reveal/hide cleanly as the width animates rather than wrapping. */
.portal-sidebar .sui-navitem__label,
.portal-sidebar__section-label {
  white-space: nowrap;
}

/* Mobile close button (shared ActionIcon) — only shown inside the drawer. */
.portal-sidebar__close {
  display: none;
  flex-shrink: 0;
  /* Trailing edge: on mobile this is the row's only control. */
  margin-left: auto;
}

.portal-sidebar__collapse {
  margin-left: auto;
  flex-shrink: 0;
}

/* Off-canvas drawer under the shell breakpoint (keep in sync with
   AppShell.css and Sidebar.tsx). Slides from the inline-start edge so RTL
   locales get the mirrored behavior for free. */
@media (max-width: 48rem) {
  .portal-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 80; /* above the scrim (75), below SUI modals (100) */
    width: min(17rem, 85vw);
    border-right: none;
    border-inline-end: 1px solid var(--color-sidebar-border);
    transform: translateX(calc(var(--sui-dir, 1) * -100%));
    visibility: hidden;
    transition:
      transform var(--motion-fast),
      visibility var(--motion-fast);
  }
  [dir="rtl"] .portal-sidebar {
    --sui-dir: -1;
  }
  .portal-sidebar--open {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.35);
  }
  .portal-sidebar__close {
    display: inline-flex;
  }
  /* Collapse is a desktop affordance; the drawer is full-width on mobile. */
  .portal-sidebar__collapse {
    display: none;
  }
}

/* ---- Collapsed icon rail (desktop only) ---- */
.portal-sidebar[data-collapsed] {
  width: var(--sidebar-collapsed-w);
}
/* Flush, like the nav: the selected row runs the full width of the rail. */
.portal-sidebar[data-collapsed] .portal-sidebar__nav {
  padding-inline: 0;
}
/* Stretch, not centre: a centred group shrinks to its content, so rows can't fill the rail. */
.portal-sidebar[data-collapsed] .portal-sidebar__section {
  padding-inline: 0;
  align-items: stretch;
}
.portal-sidebar[data-collapsed] .portal-sidebar__section-label {
  display: none;
}
.portal-sidebar[data-collapsed] .sui-navitem__label,
.portal-sidebar[data-collapsed] .sui-navitem__trailing {
  display: none;
}
.portal-sidebar[data-collapsed] .portal-sidebar__navtip {
  display: flex;
}
.portal-sidebar[data-collapsed] .sui-navitem {
  justify-content: center;
  margin-inline: 0;
  padding-inline: 0;
  width: 100%;
  /* A square target, so it takes the rail's radius rather than NavItem's pill. */
  border-radius: var(--radius-md);
}
.portal-sidebar[data-collapsed] .portal-sidebar__footer {
  margin-inline: 0.375rem;
}

.portal-sidebar__header {
  height: var(--nav-header-h);
  padding: 0 var(--nav-gutter);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-sidebar__nav {
  flex: 0 1 auto;
  overflow-y: auto;
  overflow-x: clip;
  /* No inline inset above the rows, so a row is full width and needs no bleed past the clip. */
  padding: var(--nav-gutter) 0;
  display: flex;
  flex-direction: column;
  gap: var(--nav-gutter);
}

.portal-sidebar .sui-navitem {
  margin-inline: 0;
  padding-inline: 1.75rem;
}

/* The selected view, marked as the rail marks the current app: a knocked-out solid block. */
.portal-sidebar .sui-navitem.is-active,
.portal-sidebar .sui-navitem.is-active:hover {
  background: var(--c-text);
  color: var(--c-surface);
  border-radius: 0;
}

/* On a dark ground full ink is white, so mix the block back toward the surface. */
[data-theme="dark"] .portal-sidebar .sui-navitem.is-active,
[data-theme="dark"] .portal-sidebar .sui-navitem.is-active:hover,
html[data-app-theme="midnight"] .portal-sidebar .sui-navitem.is-active,
html[data-app-theme="midnight"] .portal-sidebar .sui-navitem.is-active:hover,
[data-mantine-color-scheme="dark"] .portal-sidebar .sui-navitem.is-active,
[data-mantine-color-scheme="dark"]
  .portal-sidebar
  .sui-navitem.is-active:hover {
  background: color-mix(in srgb, var(--c-text) 80%, var(--c-surface));
  color: var(--c-surface);
}

.portal-sidebar__section {
  padding: 0.5rem 0 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Flattened here; two classes deep to beat .sui-nav-surface regardless of load order. */
.portal-sidebar .sui-nav-surface {
  background: transparent;
  border: 0;
  border-radius: 0;
}

.portal-sidebar__section-label {
  margin: 0;
  /* Its own 0.5rem, plus the inset the nav and section no longer add. */
  padding: 0 1.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--c-text-subtle);
}

.portal-sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* The shared <NavFooter> brings its own boxes, padding and gap; the sidebar
   only positions it. */
.portal-sidebar__footer {
  margin: 0 0.625rem 0.75rem;
  overflow-x: hidden;
}

/* Fills the frame, not the viewport: a 100vh sticky column would overhang it. */
.workspace-frame .portal-sidebar {
  height: 100%;
  position: static;
}

@media (max-width: 48rem) {
  .workspace-frame .portal-sidebar {
    position: fixed;
    height: auto;
  }
}