Skip to content

A platform for community discussion. Free, open, simple.

4.5 KB
Raw Blame
@use "lib/viewport";

.sidebar-section-wrapper {
  position: relative;

  /* No outline: the insertion line already says where the link lands, and it
     tracks the pointer, so a box around the section only repeats it. Row hover
     and active backgrounds go quiet for the duration, since a row under a drag
     is not one being clicked. */

  &.is-link-drop-active {
    --d-sidebar-highlight-background: transparent;
    --d-sidebar-active-background: transparent;
  }

  @include viewport.from(sm) {
    padding-block: var(--space-1);
    border-bottom: 1px solid var(--d-sidebar-section-border-color);

    &:first-child {
      padding-top: 0;
    }

    &[data-section-name="user-threads"] {
      padding-bottom: 0;
    }
  }

  .sidebar-section-header-wrapper {
    display: flex;
    border-radius: var(--d-border-radius);

    @include viewport.from(sm) {
      padding-right: var(--d-sidebar-row-horizontal-padding);
    }

    &:focus-within {
      background: var(--d-sidebar-highlight-background);
    }

    .sidebar-section-header-button {
      font-size: var(--font-down-1);
      padding-inline: var(--space-1);

      > * {
        pointer-events: none;
      }
    }

    .btn.sidebar-section-header-dropdown,
    .sidebar-section-header-button {
      background: transparent;
      padding: var(--space-1);

      .discourse-no-touch & {
        transition:
          opacity 0.25s,
          background 0.25s;
        opacity: 0;

        &:hover {
          .d-icon {
            color: var(--d-sidebar-highlight-color);
          }
        }

        &:focus {
          opacity: 1;
        }
      }

      .d-icon {
        font-size: var(--font-down-1);
        color: var(--d-sidebar-header-icon-color);
        margin: 0;
      }

      &:focus {
        background-color: var(--token-color-surface-focused);
      }
    }
  }

  &:hover {
    .sidebar-section-header-wrapper {
      .btn.sidebar-section-header-dropdown,
      .sidebar-section-header-button {
        opacity: 1;
      }
    }
  }

  // opt out of the hover reveal above, for actions that have to be found rather
  // than reached for
  &.sidebar-section--persistent-actions {
    .sidebar-section-header-wrapper {
      .btn.sidebar-section-header-dropdown,
      .sidebar-section-header-button {
        opacity: 1;
      }
    }
  }

  .sidebar-section-header {
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    padding: 0;
    font-size: var(--font-down-2-rem);
    color: var(--d-sidebar-header-color);
    font-weight: var(--d-sidebar-header-font-weight);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    gap: var(--d-sidebar-section-link-prefix-margin-right);

    &.sidebar-section-header-collapsable {
      justify-content: flex-start;

      &:hover {
        color: var(--d-sidebar-header-color);

        .d-icon {
          color: var(--d-sidebar-header-icon-color);
        }
      }

      &:focus {
        background: transparent;
      }
    }
  }

  .sidebar-section-header-text {
    line-height: normal;
    margin-right: var(--space);

    @include ellipsis;
  }

  .sidebar-section-header-global-indicator {
    margin: 0 var(--space-3) 0 var(--space-1);
    font-size: var(--font-down-2);

    .d-icon {
      margin-top: calc(-1 * var(--space-half)); // optical alignment
    }
  }

  .sidebar-section-header-caret {
    display: flex;
    flex: 0 0 auto;
    width: var(--d-sidebar-section-link-prefix-width);
    align-items: center;
    justify-content: center;

    .d-icon {
      color: var(--d-sidebar-header-icon-color);
    }
  }

  .select-kit-collection {
    .texts {
      font-size: var(--font-0);
      text-transform: none;
      line-height: var(--line-height-medium);

      .name {
        font-size: var(--font-0);
      }
    }
  }

  .sidebar-section-content {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--d-sidebar-vertical-gap);
  }
}

.sidebar-section-link-drop-indicator,
.sidebar-section-link-wrapper.is-link-drop-before::before {
  position: absolute;
  z-index: 1;
  inset-inline: var(--d-sidebar-row-horizontal-padding);
  pointer-events: none;
  border-block-start: 2px solid var(--d-drag-indicator-color);
}

.sidebar-section-link-drop-indicator {
  inset-block-end: 0;
}

.sidebar-section-link-wrapper.is-link-drop-before::before {
  content: "";
  inset-block-start: 0;
}

.fk-d-menu.sidebar-section-header-dropdown-menu-content {
  z-index: z("header") + 1;
}

.sidebar-section-header-global-indicator__content {
  .d-icon-shield-halved {
    padding-right: var(--space-1);
  }
}