github.com/hernad/nomad@v1.6.112/ui/app/styles/core/table.scss (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  @use 'sass:math';
     7  
     8  .table {
     9    color: $text;
    10    border-radius: $radius;
    11    border: 1px solid $grey-blue;
    12    border-collapse: separate;
    13    width: 100%;
    14  
    15    &:not(.no-mobile-condense) {
    16      @media #{$mq-table-overflow} {
    17        display: block;
    18        overflow-x: auto;
    19      }
    20    }
    21  
    22    &.is-fixed {
    23      table-layout: fixed;
    24  
    25      td {
    26        text-overflow: ellipsis;
    27        overflow: hidden;
    28      }
    29    }
    30  
    31    &.is-isolated {
    32      margin-bottom: 0;
    33    }
    34  
    35    &.with-foot {
    36      margin-bottom: 0;
    37      border-bottom-left-radius: 0;
    38      border-bottom-right-radius: 0;
    39  
    40      + .table-foot {
    41        margin-bottom: 1.5rem;
    42      }
    43    }
    44  
    45    &.is-compact {
    46      th,
    47      td {
    48        padding: 0.75em;
    49      }
    50  
    51      .is-selectable a {
    52        padding: 0.75em;
    53      }
    54    }
    55  
    56    &.with-collapsed-borders {
    57      border-collapse: collapse;
    58    }
    59  
    60    &.is-darkened {
    61      tbody tr:not(.is-selected) {
    62        background-color: $white-bis;
    63  
    64        &:hover {
    65          background-color: $white-ter;
    66        }
    67      }
    68  
    69      &.is-striped {
    70        tbody tr:not(.is-selected) {
    71          &:nth-child(even) {
    72            background-color: $white-ter;
    73  
    74            &:hover {
    75              background-color: darken($white-ter, 5%);
    76            }
    77          }
    78        }
    79      }
    80    }
    81  
    82    th,
    83    td {
    84      padding: 0.75em 1.5em;
    85      border: none;
    86  
    87      &.is-three-quarters {
    88        width: 75%;
    89      }
    90  
    91      &.is-two-thirds {
    92        width: 66.66%;
    93      }
    94  
    95      &.is-half {
    96        width: 50%;
    97      }
    98  
    99      &.is-one-third {
   100        width: 33.33%;
   101      }
   102  
   103      &.is-one-quarter {
   104        width: 25%;
   105      }
   106  
   107      &.is-truncatable {
   108        overflow: hidden;
   109        text-overflow: ellipsis;
   110        white-space: nowrap;
   111      }
   112  
   113      &.is-narrow {
   114        padding: 1.25em 0 1.25em 0.5em;
   115  
   116        & + th,
   117        & + td {
   118          padding-left: 0.5em;
   119        }
   120      }
   121  
   122      &.is-long-text {
   123        word-break: break-word;
   124      }
   125  
   126      // Only use px modifiers when text needs to be truncated.
   127      // In this and only this scenario are percentages not effective.
   128      &.is-200px {
   129        width: 200px;
   130        max-width: 200px;
   131      }
   132  
   133      @for $i from 1 through 11 {
   134        &.is-#{$i} {
   135          width: math.div(100%, 12) * $i;
   136          max-width: math.div(100%, 12) * $i;
   137        }
   138      }
   139  
   140      a {
   141        color: $blue;
   142        text-decoration: underline;
   143        font-weight: $weight-normal;
   144  
   145        &.is-primary {
   146          color: $text;
   147          font-weight: $weight-semibold;
   148        }
   149      }
   150    }
   151  
   152    thead {
   153      background: $white-ter;
   154      border: 1px solid $grey-blue;
   155  
   156      tr {
   157        &:hover {
   158          background-color: inherit;
   159        }
   160      }
   161  
   162      td,
   163      th {
   164        color: $grey-light;
   165        font-weight: $weight-normal;
   166        vertical-align: bottom;
   167        border-bottom: 1px solid $grey-blue;
   168  
   169        &.is-selectable {
   170          padding: 0;
   171  
   172          a {
   173            display: block;
   174            padding: 0.75em 1.5em;
   175            width: 100%;
   176            text-decoration: none;
   177            position: relative;
   178  
   179            &:hover {
   180              background-color: darken($white-ter, 5%);
   181            }
   182  
   183            &::before,
   184            &::after {
   185              position: absolute;
   186              pointer-events: none;
   187              color: $grey-light;
   188            }
   189  
   190            &::after {
   191              transform: translateX(6px);
   192            }
   193  
   194            &::before {
   195              transform: translateX(-20px);
   196            }
   197          }
   198        }
   199  
   200        &.is-active {
   201          &.desc a::after {
   202            content: '⬆';
   203          }
   204  
   205          &.asc a::after {
   206            content: '⬇';
   207          }
   208  
   209          &.has-text-right {
   210            a::after {
   211              content: none;
   212            }
   213  
   214            &.desc a::before {
   215              content: '⬆';
   216            }
   217  
   218            &.asc a::before {
   219              content: '⬇';
   220            }
   221          }
   222        }
   223  
   224        a {
   225          color: $grey;
   226        }
   227      }
   228    }
   229  
   230    tbody {
   231      tr {
   232        &.is-interactive {
   233          cursor: pointer;
   234          box-sizing: border-box;
   235        }
   236  
   237        &.is-active {
   238          background: rgba($blue, 0.1);
   239  
   240          td:first-child {
   241            position: relative;
   242  
   243            &::after {
   244              position: absolute;
   245              content: '';
   246              width: 3px;
   247              top: 0;
   248              bottom: 0;
   249              left: -1px;
   250              display: block;
   251              background: $blue;
   252            }
   253          }
   254        }
   255      }
   256  
   257      td.is-subheading {
   258        font-weight: $weight-bold;
   259        background: $white;
   260        color: $blue;
   261      }
   262  
   263      td {
   264        border: 1px solid $grey-blue;
   265        border-width: 0 0 1px;
   266        padding: 1.25em 1.5em;
   267  
   268        &.is-one-line {
   269          white-space: nowrap;
   270        }
   271      }
   272    }
   273  
   274    .is-faded {
   275      color: $grey-light;
   276    }
   277  }
   278  
   279  .table tfoot,
   280  .table-foot {
   281    margin-top: -1px;
   282    background: $white-ter;
   283    border: 1px solid $grey-blue;
   284    border-bottom-right-radius: $radius;
   285    border-bottom-left-radius: $radius;
   286    overflow: hidden;
   287    display: flex;
   288    justify-content: space-between;
   289    align-items: center;
   290  
   291    &.with-padding {
   292      padding: 6px;
   293    }
   294  
   295    .pagination {
   296      padding: 0;
   297      margin: 0;
   298    }
   299  
   300    // Field overrides specifically for use of Field within a table foot.
   301    // Bulma does a lot of typically helpful layout tweaks at different
   302    // breakpoints that are undesirable in this context.
   303    .field {
   304      margin-bottom: 0;
   305  
   306      &:first-child {
   307        margin-left: 1.5em;
   308      }
   309  
   310      &.is-horizontal {
   311        display: flex;
   312      }
   313  
   314      .label,
   315      .field-label {
   316        color: $grey;
   317        flex-basis: 0;
   318        flex-grow: 1;
   319        flex-shrink: 0;
   320        text-align: right;
   321  
   322        &.is-small {
   323          font-size: $size-7;
   324        }
   325      }
   326  
   327      .field-body {
   328        display: flex;
   329        flex-basis: 0;
   330        flex-grow: 5;
   331        flex-shrink: 1;
   332      }
   333    }
   334  }