Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

3.3 KB
Raw Blame
@use "@fider/assets/styles/variables.scss" as *;

.c-button {
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: get("font.size.base");
  border-radius: 8px;
  border: none;
  padding: 8px 16px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;

  &:active {
    transform: scale(0.98);
  }

  svg + *,
  img + * {
    margin-inline-start: spacing(1);
  }

  &--tertiary {
    color: var(--colors-gray-900);
    background-color: transparent;

    &:hover {
      text-decoration: underline;
    }
  }

  &--secondary {
    color: var(--colors-gray-900);
    background-color: var(--colors-white);
    border: 1px solid var(--colors-gray-300);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);

    &:hover {
      background-color: var(--colors-gray-50);
      border-color: var(--colors-gray-400);
      box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    }
  }

  &--primary {
    color: var(--colors-white);
    background-color: var(--colors-primary-base);
    border: 1px solid var(--colors-primary-base);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

    &:hover {
      background-color: var(--colors-primary-dark);
      box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
    }
  }

  &--danger {
    color: var(--colors-red-600);
    border: 1px solid var(--colors-gray-300);
    background-color: var(--colors-white);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);

    &:hover {
      color: var(--colors-white);
      border: 1px solid var(--colors-red-600);
      background-color: var(--colors-red-600);
      box-shadow: 0 2px 4px 0 rgba(220, 38, 38, 0.2);
    }
  }

  &--link {
    border: none;
    color: var(--colors-primary-base);
    background-color: transparent;
  }

  &--no-padding {
    padding: 0;
    font-size: get("font.size.sm");

    svg,
    img {
      height: sizing(4);
    }
  }

  &--small {
    padding: 6px 10px;
    font-size: 11px;

    svg,
    img {
      height: sizing(3);
    }
  }

  &--default {
    padding: 11px 12px;
    font-size: get("font.size.sm");

    svg,
    img {
      height: sizing(4);
    }
  }

  &--large {
    padding: 10px 14px;
    font-size: get("font.size.lg");

    svg,
    img {
      height: sizing(5);
    }
  }

  &--loading {
    position: relative;
    cursor: default;
    color: transparent;
    opacity: 1;
    pointer-events: auto;
    transition: all 0s linear, opacity 0.1s ease;

    &:before {
      position: absolute;
      content: "";
      top: 50%;
      left: 50%;
      margin: -0.64285714em 0 0 -0.64285714em;
      width: 1.28571429em;
      height: 1.28571429em;
      border-radius: 500rem;
      border: 0.2em solid var(--colors-gray-500);
    }

    &:after {
      position: absolute;
      content: "";
      top: 50%;
      left: 50%;
      margin: -0.64285714em 0 0 -0.64285714em;
      width: 1.28571429em;
      height: 1.28571429em;
      animation: button-spin 0.6s linear;
      animation-iteration-count: infinite;
      border-radius: 500rem;
      border-color: get("colors.white") transparent transparent;
      border-style: solid;
      border-width: 0.2em;
      box-shadow: 0 0 0 1px transparent;
    }
  }

  &--disabled {
    @include disabled();
  }
}

@keyframes button-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}