Skip to content

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

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

// styles that apply to the popup that appears when you show the edit history of a post
.d-modal.history-modal {
  .d-modal__footer {
    justify-content: space-between;
  }

  #revision-numbers {
    display: inline-block;
    min-width: 7em;
    text-align: center;
  }

  #revision {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5em 0;
    align-items: center;
    padding-bottom: 0.5em;
    overflow: auto;
    border-bottom: 3px solid var(--primary-low);

    @include viewport.until(md) {
      padding-bottom: 0;
    }

    @include viewport.until(sm) {
      padding-bottom: 0.5em;
    }
  }

  #revision-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
  }

  #display-modes {
    .nav {
      margin: 0;
      padding: 0;
      border: none;
    }

    @include viewport.until(md) {
      width: 100%;
      margin-top: 0.5em;

      .nav-pills {
        width: 100%;

        li {
          margin: 0;
          flex: 1 1 auto;
        }

        a {
          width: 100%;
          justify-content: center;
        }
      }
    }
  }

  .revision-details__user {
    display: flex;
    align-items: center;
    gap: 0.25em;
  }

  .revision-details__unlisted {
    color: var(--primary-medium);

    .fk-d-tooltip__trigger-container {
      align-items: center;
      gap: 0.25em;
    }
  }

  .revision__title,
  .revision__locale,
  .body-diff,
  table.markdown > tbody > tr,
  .-tag-revisions {
    --gap-width: 1rem;
    display: flex;
    gap: 0 var(--gap-width);
  }

  .mobile-view & {
    .-tag-revisions {
      display: block;
    }

    .discourse-tags {
      display: inline;
      font-size: var(--font-down-1);
    }
  }

  .inline-diff {
    width: 100%;
    max-width: var(--modal-max-width);
  }

  pre {
    display: flex;
  }

  pre code {
    overflow-wrap: anywhere; // prevent long strings from breaking modal width
    min-width: 0;
    flex: 0 1 auto;
  }

  .revision__title {
    margin: 0;
    line-height: var(--line-height-medium);
  }

  .revision__locale {
    font-size: var(--font-down-1);
    color: var(--primary-high);
    margin-top: 0.5em;
    margin-bottom: 0.5em;

    .diff-ins,
    .diff-del {
      width: fit-content;
    }
  }

  .revision__hidden-notice {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 1em 0;
    color: var(--primary-medium);
  }

  &:not(.--mode-inline) {
    .-tag-revisions .tag-revision__wrapper {
      flex: 0 1 50%;
      min-width: 0;
      align-self: start;
    }
  }

  .revision-content {
    flex: 0 1 50%;
    min-width: 0;
  }

  .markdown {
    font-family: var(--d-font-family--monospace);
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;

    td {
      overflow-wrap: anywhere;
      white-space: pre-wrap;
      flex: 0 1 50%;
    }

    tbody {
      border: none;
    }
  }

  #revision-controls {
    display: flex;
    align-items: center;

    .btn {
      margin: 0;
    }

    @include viewport.until(md) {
      width: 100%;
      justify-content: space-between;
    }
  }

  [class^="revision-controls--"] {
    display: flex;
    gap: 0 1em;
  }

  #revisions {
    overflow-wrap: break-word;

    table {
      margin-top: 10px;

      tr {
        border: none;
      }
    }

    .row:first-of-type {
      margin-top: 10px;
    }

    .revision-content table {
      thead {
        th {
          padding-bottom: 2px;
          font-weight: bold;
          color: var(--primary);
        }
      }

      td {
        padding: 3px 3px 3px 0.5em;

        img {
          max-width: none;
        }
      }
    }
  }

  #revision-footer-buttons {
    display: flex;
    gap: 0.5em;

    button {
      margin: 0;
      flex: 1 1 auto;
      min-width: 0;

      .d-button-label {
        @include ellipsis;
      }
    }

    @include viewport.until(md) {
      width: 100%;
      flex: 1 1 100%;
      flex-wrap: wrap;

      button {
        font-size: var(--font-down-1);
      }
    }
  }

  img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
  }

  ins,
  del,
  .diff-ins,
  .diff-del {
    color: var(--primary);

    &:not(s, .bbcode-u, .bbcode-s) {
      text-decoration: none;
    }

    code,
    img {
      border: 2px solid;
    }

    a {
      text-decoration: none;
    }

    > .title,
    > blockquote {
      background: transparent;
    }
  }

  ins,
  .diff-ins {
    background: var(--success-low);

    code,
    img {
      border-color: var(--success);
    }

    img {
      opacity: 0.75;
      filter: alpha(opacity=75);
    }

    a {
      color: var(--success);
    }
  }

  del,
  .diff-del {
    background: var(--danger-low);

    code,
    img {
      border-color: var(--danger);
    }

    img {
      opacity: 0.5;
      filter: alpha(opacity=50);
    }

    a {
      color: var(--danger);
    }
  }

  span.date {
    font-weight: bold;
  }

  span.edit-reason {
    background-color: var(--highlight-bg);
  }

  .d-icon-ban {
    color: var(--danger);
  }

  .hidden-revision-either {
    opacity: 0.5;
  }

  .hidden-revision-previous .row {
    .--previous {
      opacity: 0.5;
    }
  }

  .hidden-revision-current .row {
    .--current {
      opacity: 0.5;
    }
  }
}