@use "sass:map";
@use "@twig/scss/_global" as global;
@use "@twig/scss/variables/_variables-components" as components;

$params: (
   "color": global.$text-dark,
   "font-size": global.$font-size-base,
   "font-weight": global.$font-weight-base,

   "icon": true,
   "icon-color": global.$text-dark,
   "icon-size": global.$font-size-larger,
   "icon-margin-right": global.$gap-width,
);

@if global-variable-exists(c-product-customlinks-linkitem, components) {
   $keys: map.keys(components.$c-product-customlinks-linkitem);
   @each $name in $keys {
      @if not map.get($params, $name) {
         @warn "Neexistující proměnná '#{$name}' v komponentě '$#{component("Product:CustomLinks:LinkItem", "class")}'.";
      }
   }

   $params: map.merge($params, components.$c-product-customlinks-linkitem);
}

.#{component("Product:CustomLinks:LinkItem", "class")} {
   display: flex;
   align-items: center;
   cursor: pointer;

   .c-icon {
      @if (map.get($params, "icon") == true) {
         display: flex;
      } @else {
         display: none;
      }

      color: map.get($params, "icon-color");
      font-size: map.get($params, "icon-size");
      margin-right: map.get($params, "icon-margin-right");
   }

   .text {
      color: map.get($params, "color");
      font-size: map.get($params, "font-size");
      font-weight: map.get($params, "font-weight");
   }
}
