Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { isPresent } from '@ember/utils';
import { readOnly } from '@ember/object/computed';
import LazyLqipMixin from 'ember-lazy-responsive-image/mixins/lazy-lqip-mixin';
import { htmlSafe } from '@ember/string';
import ResponsiveBackgroundComponent from 'ember-responsive-image/components/responsive-background';
/**
* This component extends the `ResponsiveBackground`-Component in a lazy manner and supports LQIP technique
*
*
* @class ResponsiveBackground
* @extends Ember.Component
* @namespace Components
* @public
*/
export default ResponsiveBackgroundComponent.extend(LazyLqipMixin, {
attributeBindings: ['data-bgset', 'data-sizes'],
/**
* insert the stylesheets with the background image to the consumer
*
* @property style
* @type string
* @private
*/
style: computed('lqipSrc', function() {
if (isPresent(this.get('lqipSrc'))) {
return htmlSafe(`background-image: url('${this.get('lqipSrc')}');`);
}
return null;
}),