github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/styles/core/table.scss (about)

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