import Masonry from 'masonry-layout';

(function ($) {
	'use strict';
	$(document).ready(function () {
		var container =
			'.flo-block-post-grid.flo-block-post-grid--masonry .flo-block-post-grid__items';

		$( container ).each(function( ) {
			const initMasonry = () => {
				new Masonry(this, {
					itemSelector: '.flo-block-post-grid__item',
					transitionDuration: '0.2s',
					percentPosition: true,
				});
			};
			if ($(this).length) {
				$(this).find('img').on('load', initMasonry);
				initMasonry();
			}
		});
	});
})(jQuery);
