{% macro printStyle(styles) %}
    {% for key,value in styles %}
        {% if key == 'before' %}
            &:before {
            {{ _self.printStyle(styles[key]) }}
            }
        {% elseif key == 'after' %}
            &:after {
            {{ _self.printStyle(styles[key]) }}
            }
        {% elseif value != '' %}
            {{ key }}: {{ value|raw }};
        {% endif %}
    {% endfor %}
{% endmacro %}

{% set properties = item.properties|json_decode %}

{{ StyleHelper.generatePresetSelector('.moto-widget-image', item.class_name) }} {
    .moto-widget-image-link {
        {{ _self.printStyle(properties.image.desktop.base) }}

        &:after {
            {{  _self.printStyle(properties.icon.desktop.base.after) }}
        }

        &:before {
            {{  _self.printStyle(properties.layer.desktop.base) }}
        }

        &:hover {
            {{  _self.printStyle(properties.image.desktop.hover) }}

            &:after {
                {{  _self.printStyle(properties.icon.desktop.hover.after) }}
            }

            &:before {
                {{  _self.printStyle(properties.layer.desktop.hover) }}
            }
        }
    }
}
