@import 'shared/common';

/** 取得字體色票顏色，get-uofx-text-color(d|2|4|5) or get-uofx-text-color(#fff) */
@function get-uofx-text-color($t-color) {
  @return map-get-lax($u-text-color, $t-color);
}

/** 取得字體大小，get-uofx-text-size(t2|2|st1|st2|b1|b3) */
@function get-uofx-text-size($t-size) {
  $fontSize: map-get-lax($u-text, $t-size);
  @return get-scale-size($fontSize);
}

/** 取得字體粗細，get-uofx-text-weight(l|r|m)*/
@function get-uofx-text-weight($t-weight) {
  @return map-get-lax($u-text-weight, $t-weight);
}

/** @include uofx-text-size(b1) or uofx-text-size(12) */
@mixin uofx-text-size($value) {
  font-size: get-uofx-text-size($value);
}

/** @include text-size(12) */
@mixin text-size($value) {
  font-size: get-scale-size($value);
}

// @include text-type(d, t2, l)
// @include text-type(2, t3, r)
// @include text-type(4, st1, m)
@mixin text-type($t-color, $t-size, $t-weight) {
  color: get-uofx-text-color($t-color);
  font-weight: get-uofx-text-weight($t-weight);
  @include uofx-text-size($t-size);
}

/** 最多幾行，@include max-line(2) */
@mixin max-line($number) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $number;
  -webkit-box-orient: vertical;
  word-break: break-all;
  white-space: normal;

  @if ($number == 1) {
    word-break: break-all;
  } @else {
    word-break: break-word;
  }
}
