Skip to content

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

3.3 KB
Raw Blame
.chat-composer-upload {
  display: inline-flex;
  height: 64px;
  padding: 0.5rem;
  border: 1px solid var(--primary-low-mid);
  margin-right: 0.5em;
  position: relative;
  border-radius: var(--d-border-radius);
  box-sizing: border-box;

  &--with-preview {
    padding: 0;

    .preview-img,
    .preview-video {
      height: 62px;
      width: 62px;
      box-sizing: border-box;
    }

    &.chat-composer-upload--in-progress {
      .preview-img,
      .preview-video {
        opacity: 0.5;
      }

      .data {
        position: absolute;
        inset: auto 0 0 0;
      }

      .bottom-data {
        justify-content: center;
      }

      .data .upload-progress {
        width: 100%;
        height: 4px;
        border-radius: 0;
      }
    }
  }

  &:last-child {
    margin-right: 0;
  }

  &:hover {
    .chat-composer-upload__remove-btn {
      visibility: visible;
    }
  }

  &__remove-btn {
    --d-button-flat-bg-color: rgb(var(--always-black-rgb), 0.9);
    --d-button-flat-bg-color--hover: rgb(var(--always-black-rgb), 0.9);
    --d-button-flat-bg-color--focus: rgb(var(--always-black-rgb), 0.9);
    --d-button-flat-icon-color: #fff;
    --d-button-flat-icon-color--hover: #fff;
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    min-height: 0;
    padding: 0;
    border: 1px solid var(--primary-medium);
    border-radius: 50%;
    font-size: var(--font-down-2);
    line-height: 1;
    visibility: hidden;

    .d-icon {
      margin: 0;
    }
  }

  &__preview-btn {
    padding: 0;
    cursor: zoom-in;
  }

  // beats the shared button focus style, which removes the outline
  .chat-composer-upload__preview-btn:focus-visible {
    outline: 2px solid var(--tertiary);
    outline-offset: 2px;
  }

  // outside the button, so button icon colours don't apply to it
  .preview-video__badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--font-up-1);
    color: #fff;
    background: rgb(var(--always-black-rgb), 0.6);
    border-radius: 100%;
    padding: 0.35em;
    pointer-events: none;
  }

  .preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;

    .d-icon {
      font-size: var(--font-up-6);
      margin-right: 0.5rem;
    }

    .preview-img,
    .preview-video {
      object-position: center;
      object-fit: cover;
      border-radius: var(--d-border-radius);
    }
  }

  .data {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: var(--line-height-medium);
    font-size: var(--font-down-1);
    color: var(--primary-high);

    .top-data,
    .bottom-data {
      display: flex;
      align-items: center;
    }

    .file-name {
      display: inline-block;
      max-width: 150px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      margin-right: 0.5em;
    }

    .uploading,
    .processing {
      font-size: var(--font-down-2);
      margin-right: 0.75em;
    }

    .upload-progress {
      width: 110px;
    }

    .extension-pill {
      background: var(--primary-low);
      border-radius: var(--d-border-radius);
      font-size: var(--font-down-2-rem);
      padding: 0.1em 0.4em;
    }
  }
}