//
// Belgrade Icons
// - Add icons to certain buttons and links
// ----------------------------
@import "../global";

$icons: (
  "add": "plus",
  "arrow-repeat": "arrow-repeat",
  "basket": "basket",
  "heart": "heart-fill",
  "cart-add": "cart-plus-fill",
  "card": "credit-card-2-back-fill",
  "trash": "trash",
  "edit": "pencil-square",
  "remove": "dash-circle-fill"
);

$icon-size: 1.2rem;

@function get_icon($key) {
  @return map-get($icons, $key);
}

// Icon Classes
@each $icon, $icon_name in $icons {
  .bi-btn-#{$icon} {
    @include btn-icon($icon-size, "../../icons/#{$icon_name}.svg");
  }
}

.delete-order-item {
  @include icon($icon-size, '../../icons/#{get_icon("trash")}.svg');
}
.checkout-pane [value="Edit"] {
  @include btn-icon($icon-size, '../../icons/#{get_icon("edit")}.svg');
}

// Edit links on checkout review page
.checkout-pane-review
  > .checkout-pane
  > .accordion
  > .accordion-item
  > .accordion-header
  .accordion-button
  a {
  @include icon(
    $icon-size,
    '../../icons/#{get_icon("edit")}.svg',
    currentColor
  );
}

// Address book
.links .edit > a,
.address-book__edit-link {
  @include icon(
    $icon-size,
    '../../icons/#{get_icon("edit")}.svg',
    $secondary,
    $success
  );
}
.links .delete > a,
.address-book__delete-link {
  @include icon(
    $icon-size,
    '../../icons/#{get_icon("trash")}.svg',
    $secondary,
    $danger
  );
}

// Wishlist with Icons
[data-drupal-selector="edit-wishlist"].btn-link {
  color: $secondary; // move this to wishlist overrides
  @include btn-icon(
    $icon-size,
    '../../icons/#{get_icon("heart")}.svg',
    $secondary,
    $danger
  );
}

.wishlist-item__details {
  display: flex;
  align-items: center;
}

.wishlist-item .wishlist-item__details-edit-link {
  @include icon(
    $icon-size,
    '../../icons/#{get_icon("edit")}.svg',
    $secondary,
    $success
  );
}

.wishlist-item__actions {
  .btn-success {
    @include btn-icon-only(
      $icon-size,
      '../../icons/#{get_icon("cart-add")}.svg'
    );
  }
  .btn-danger {
    @include btn-icon-only($icon-size, '../../icons/#{get_icon("trash")}.svg');
  }
}

// Coupon
.coupon-redemption-form__coupons .btn-danger {
  @include icon(
    $icon-size,
    '../../icons/#{get_icon("remove")}.svg',
    var(--#{$prefix}primary),
    $danger
  );
}
