Skip to content

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

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

:where(.uc-enable-composer-redesign) {
  // flat to match the rest of the bar, aligned to the content gutter
  #reply-control .reply-to .composer-actions-trigger {
    padding-inline-start: 0;
    background: transparent;
    border-color: transparent;

    .d-button-label {
      font-weight: 600;
    }
  }

  #reply-control {
    // the redesigned grippie is taller than the height the default layout
    // reserves for it, so size the reply area with flex instead
    .grippie ~ .reply-area {
      flex: 1 1 auto;
      height: auto;
      min-height: 0;
    }

    // structure properly when :where is gone
    &.hide-preview .d-editor-container {
      grid-template-columns: 1fr;
      grid-template-areas:
        "fields"
        "editor";
    }
  }

  .grippie {
    padding-block: var(--space-1);
    border-top-left-radius: var(--d-border-radius-large);
    border-top-right-radius: var(--d-border-radius-large);
  }

  .reply-to {
    padding: var(--space-2) var(--space-4);
    margin: 0 !important;
    border-bottom: 1px solid var(--primary-low);
  }

  .reply-area {
    container-type: inline-size;
    padding: 0 !important;
  }

  .composer-controls {
    .btn {
      font-size: var(--font-down-1-rem);
    }
  }

  #reply-control .title-and-category {
    padding: 0 !important;
    width: 100% !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--primary-low);
    flex-wrap: nowrap !important;

    .user-selector {
      margin: 0 !important;
    }
  }

  .category-input,
  .user-selector {
    border-right: 1px solid var(--primary-low);

    @include viewport.until(sm) {
      flex-grow: 1;
    }
  }

  .tags-input {
    &:not(:last-child) {
      border-right: 1px solid var(--primary-low);
    }

    @include viewport.until(sm) {
      flex-grow: 0 !important;
    }

    @include viewport.until(sm) {
      .select-kit {
        .formatted-selection {
          display: none !important;
        }
      }
    }

    .select-kit-header-wrapper {
      gap: var(--space-1);

      .formatted-selection {
        color: var(--primary-medium);
      }

      .d-icon-plus {
        @include viewport.until(sm) {
          display: none;
        }
      }

      .d-icon-tag {
        color: var(--primary-low-mid) !important;
      }

      .multi-select-header__selected-count {
        @include viewport.from(sm) {
          display: none;
        }
      }
    }

    .has-selection {
      .select-kit-header-wrapper {
        .formatted-selection {
          color: var(--primary-high);
        }

        .d-icon-tag {
          color: var(--tertiary) !important;
        }
      }
    }
  }

  .category-input,
  .tags-input,
  .user-selector {
    margin: 0 !important;
    max-width: unset !important;
    width: 50% !important;
    box-sizing: border-box;

    @include viewport.until(sm) {
      width: auto !important;
    }

    .category-chooser.is-expanded,
    .mini-tag-chooser.is-expanded,
    .user-chooser.is-expanded {
      .select-kit-header {
        outline: 0 !important;
      }
    }

    .select-kit.combo-box .select-kit-header,
    .select-kit.multi-select .multi-select-header {
      border: 0;
      padding: var(--space-3) var(--space-4);
      border-radius: 0;

      &:active {
        border: 0;
        outline: 0;
      }

      .d-icon:not(.badge-category *) {
        font-size: var(--font-down-1-rem);
        color: var(--primary-medium);
      }
    }
  }

  // TODO move to plugin css when UC is removed
  .showing-ai-suggestions #reply-title {
    padding-right: calc(var(--space-7) + 27px);
  }

  .title-input {
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--primary-low);

    #reply-title {
      border: 0;
      padding: var(--space-4);
      font-weight: 600;
      margin-bottom: 0 !important;
      padding-bottom: var(--space-3) !important;
      padding-right: var(--space-3) !important;
      flex-basis: unset !important;

      &::placeholder {
        color: var(--primary-medium);
      }

      &:focus {
        outline: 0;
      }
    }

    // TODO move to plugin css when UC is removed
    .suggest-titles-button {
      position: relative;
      bottom: unset !important;
      right: unset !important;
      transform: none !important;
      margin-inline-end: var(--space-3);
    }
  }

  #reply-control .d-editor-textarea-wrapper {
    --composer-slide-easing: cubic-bezier(0.2, 0, 0, 1);
    border: 0;
    border-radius: 0; // core overrule

    // padding and border-radius must animate in lockstep with margin,
    // otherwise the text counter-jumps when the focus state toggles
    transition:
      margin 250ms var(--composer-slide-easing),
      padding 250ms var(--composer-slide-easing),
      border-radius 250ms var(--composer-slide-easing),
      box-shadow 250ms ease;

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

    &:focus,
    &.in-focus {
      outline: none;
      border: 0;
    }
  }

  #reply-control.has-composer-fields .d-editor-textarea-wrapper {
    &:focus,
    &:focus-within,
    &.in-focus {
      @include viewport.until(sm) {
        margin-top: calc(
          (
              var(--composer-fields-height, 0px) +
                (var(--header-offset, 0px) / 3)
            ) *
            -1
        );
        z-index: z("composer", "dropdown") + 1;
        box-shadow: 0 -12px 12px 0 rgb(var(--primary-rgb), 0.15);
        border-top-left-radius: var(--d-border-radius-large);
        border-top-right-radius: var(--d-border-radius-large);
        padding-top: var(--space-4);

        &::before {
          content: "";
          position: absolute;
          inset-block-start: var(--space-2);
          inset-inline-start: 50%;
          transform: translateX(-50%);
          width: 15vw;
          height: 5px;
          background: var(--primary-medium);
          border-radius: var(--d-border-radius-pill);
        }
      }
    }
  }

  @include viewport.until(sm) {
    #reply-control.has-composer-fields
      .reply-area:has(.d-editor-textarea-wrapper.in-focus)
      .reply-to {
      pointer-events: none;
    }
  }

  #reply-control .d-editor-button-bar__wrap {
    margin-inline: 0;
  }

  #reply-control .d-editor-input {
    padding-inline: var(--space-4) !important;

    &:focus-visible {
      outline: 0;
    }
  }

  .wmd-controls:not(.toolbar-visible)
    ~ .composer-footer
    .d-editor-button-bar__wrap {
    display: none;
  }

  #reply-control .d-editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: min-content 1fr;
    grid-template-areas:
      "fields fields"
      "editor preview";

    &.--rich-editor-enabled {
      grid-template-columns: 1fr;
      grid-template-areas:
        "fields"
        "editor";
    }

    .composer-fields {
      grid-area: fields;
      min-width: 0;

      @include viewport.until(sm) {
        max-width: 100vw;
        box-sizing: border-box;
      }
    }

    .d-editor-textarea-column {
      grid-area: editor;
      min-height: 0;
    }

    .d-editor-preview-wrapper {
      grid-area: preview;
    }
  }

  // clean up selector once the uc- body class is no longer in the way
  .show-preview .d-editor-container.--markdown-editor-enabled {
    .d-editor-preview-wrapper {
      border-left: 1px solid var(--primary-low);
      margin: 0;
      padding: var(--space-2) var(--space-4);
    }
  }

  .composer-footer {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;

    @container (width < 600px) {
      flex-direction: column;
    }

    @container (width > 600px) {
      border-top: 1px solid var(--primary-low);
      padding: var(--space-2) var(--space-4);
    }

    &__toolbar {
      overflow: hidden;
      max-width: 100%;
      width: 100%;
      box-sizing: border-box;

      @container (width < 600px) {
        padding: 0 var(--space-4);
        border-top: 1px solid var(--primary-low);
        border-bottom: 1px solid var(--primary-low);
      }

      @include viewport.until(sm) {
        padding-inline: var(--space-2);
        border-top: 1px solid var(--primary-low);
      }
    }

    .submit-panel {
      margin: 0 !important;

      @container (width < 600px) {
        padding: var(--space-2) var(--space-4);
        align-self: end;
      }

      @include viewport.until(sm) {
        width: 100%;
        padding: var(--space-2) var(--space-2) 0; // parent has env safe area padding for bottom
        box-sizing: border-box;

        .save-or-cancel {
          display: inline-flex !important;
          margin-left: auto;
          flex: unset !important;
          margin-right: 0 !important;

          // temporary overrule, should be done in template eventually
          .btn.btn-primary {
            background: transparent;
            color: var(--tertiary);
            font-weight: bold;
          }
        }

        #draft-status {
          margin-left: 0 !important;
        }
      }
    }

    .d-editor-button-bar__wrap {
      @include viewport.until(sm) {
        margin: 0;
      }
    }

    .d-editor-button-bar {
      @include viewport.until(sm) {
        padding-inline: var(--space-2);
      }

      &__scroll-btn {
        color: var(--primary-medium);
        font-size: var(--font-down-1-rem);
      }

      .btn,
      .composer-toggle-switch__left-icon,
      .composer-toggle-switch__right-icon {
        font-size: var(--font-down-1-rem);
      }
    }

    .composer-toggle-switch {
      margin-left: 0;
    }
  }

  @include viewport.until(sm) {
    .reply-area {
      background: var(--secondary);
      padding: 0 0 max(env(safe-area-inset-bottom), var(--space-2)) !important;

      html.keyboard-visible & {
        padding-bottom: var(--space-2) !important;
      }
    }

    .reply-to {
      padding: var(--space-1) var(--space-3);
    }
  }

  // PM specific removals/overrules
  #reply-control.private-message .with-tags .title-input {
    max-width: unset;
  }
}