web/src/styles/_mixins.scss

109 lines · 2010 bytes

  1$bp-mobile: 768px;
  2
  3@mixin underline-hover(
  4  $color: var(--accent),
  5  $height: 3px,
  6  $width: 100%,
  7  $speed: 0.3s
  8) {
  9  position: relative;
 10  &:after {
 11    content: '';
 12    display: block;
 13    position: absolute;
 14    bottom: 0;
 15    left: 50%;
 16    width: 0;
 17    height: $height;
 18    background: $color;
 19    transition:
 20      width $speed ease,
 21      left $speed ease;
 22  }
 23  &:hover:after {
 24    width: $width;
 25    left: 0;
 26  }
 27}
 28
 29@mixin truncate {
 30  text-overflow: ellipsis;
 31  overflow: hidden;
 32  white-space: nowrap;
 33}
 34
 35@mixin line-clamp($lines: 3) {
 36  display: -webkit-box;
 37  -webkit-line-clamp: $lines;
 38  -webkit-box-orient: vertical;
 39  overflow: hidden;
 40}
 41
 42@mixin detail-info-layout {
 43  display: flex;
 44  flex-wrap: wrap;
 45  justify-content: space-between;
 46  gap: var(--space-md);
 47  .left,
 48  .right {
 49    width: calc(50% - 1rem);
 50    @media screen and (max-width: $bp-mobile) {
 51      width: 100%;
 52    }
 53  }
 54}
 55
 56@mixin detail-info-base {
 57  h4 {
 58    margin: var(--space-md) 0 0 0;
 59    font-size: var(--text-md);
 60  }
 61  p {
 62    margin: 0;
 63    display: flex;
 64    align-items: center;
 65    gap: var(--space-xs);
 66    :global(svg) {
 67      width: var(--text-base);
 68    }
 69    img {
 70      border-radius: var(--curve-sm);
 71    }
 72  }
 73  ul {
 74    padding-left: 0;
 75    list-style: none;
 76    max-height: 300px;
 77    overflow-y: auto;
 78    overflow-x: hidden;
 79    img {
 80      border-radius: var(--curve-sm);
 81    }
 82    .list-item {
 83      display: flex;
 84      flex-direction: column;
 85      margin-bottom: var(--space-sm);
 86    }
 87    &.list-table {
 88      font-size: var(--text-sm);
 89      padding-left: 0;
 90      li {
 91        display: flex;
 92        justify-content: space-between;
 93        padding: 0.1rem 0;
 94        &:not(:last-child) {
 95          border-bottom: 1px solid var(--accent-3-translucent);
 96        }
 97      }
 98    }
 99  }
100}
101
102@mixin changelog-badge {
103  font-size: var(--text-sm);
104  padding: 0.05rem 0.35rem;
105  border-radius: var(--curve-sm);
106  font-family: var(--font-subtitle);
107  text-transform: uppercase;
108  font-weight: bold;
109}