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

$params: (
   "color": global.$white,
   "background": global.$brand-primary,
   "border-color": global.$brand-primary,
   "icon-size": 20px,
   "icon-left-absolute": true,
   "icon-right-absolute": 'false',
   "width": 100%,
);

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

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

.#{component("Product:WatchDog", "class")} {
   @include global.button-variant(map.get($params, "color"), map.get($params, "background"), map.get($params, "border-color"));

   width: map.get($params, "width");
   position: relative;
   overflow: hidden;

   > .c-icon {
      font-size: map.get($params, "icon-size");

      @if (map.get($params, "icon-left-absolute")) {
         position: absolute;
         left: 20px;
      } @else if (map.get($params, "icon-right-absolute") == true) {
         position: absolute;
         right: 20px;
      } @else {
         margin-right: global.$gap-width;
      }
   }
}

