Components
53
Accordion Items Article Selection Author Info Basic Carousel Basic Hero Basic Map Blog Pull Out Carousel Carousel Contact Content Accordion Content Carousel Content Image Cta Cta Bar Cta Blocks Cta Collage Event Content Events Grid Example Find Firm Firm Search Firms By Town Gated Content Download Guides Carousel Hero History Homepage Hero Image Content Cta Image List Content Industries Job Content Job Listings Local Firm Carousel Our Firms Pages Carousel Partners Partners Slider People Listing Post Carousel Post Feed Pullquote Section Wrap Service List Split Content Stats Tax Guides Team Grid Title Logos Two Column Video Video Carousel Video Old

Local Firm Carousel

Field
Field Type
Field Name
Instructions
Background Colour
select
block_local_firm_carousel_background_colour
Overline
text
block_local_firm_carousel_overline
Content
wysiwyg
block_local_firm_carousel_content
Show All Locations
true_false
block_local_firm_carousel_show_all
Locations
taxonomy
block_local_firm_carousel_locations
Call To Action
group
block_local_firm_carousel_cta
-- Content
text
content
-- Link
link
link

				
@import "../../resources/scss/util/variables";
@import "../../resources/scss/util/mixins";

// Location search
@import "../../resources/scss/elements/location-search";

.block-local-firm-carousel {

	&.background-color-blue {
		background-color: #F2FBFE;

		.slide-intro {
			background: #F2FBFE
		}
	}

	&__slide {
		position: relative;
		height: rem-calc(292);
		background-color: #cccccc;
		width: rem-calc(253);
		overflow: hidden;


		@include bp($lg) {
			height: rem-calc(704);
			width: rem-calc(464);
		}
		a {
			display: block;
			height: 100%;
			width: 100%;

			&:hover {
				picture {
					img {
						transform: scale(1.05);
					}
				}
			}
		}
		&-content {
			&:before {
				content: '';
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				background: linear-gradient(180deg, rgba(0, 0, 0, 0) 62.93%, rgba(0, 0, 0, 0.7) 100%);
			}
		}

		&-name {
			font-size: rem-calc(30px);
			font-weight: 600;
			color: $white;
			text-transform: uppercase;
			font-weight: 600;
			letter-spacing: rem-calc(1);
			position: absolute;
			left: 0;
			right: 0;
			bottom: 0;
			padding: 1rem;
			margin-bottom: 0;
			transition: color 0.3s ease-in-out;
			line-height: 1.25;

			@include bp($lg) {
				font-size: rem-calc(40px);
				padding: 2rem;
			}
		}

		&-image {
			width: 100%;
			margin-bottom: rem-calc(24);

			picture {
				width: 100%;
			}

			img {
				transition: transform 0.3s ease-in-out;
			}
		}
	}

	.swiper-container {
		position: relative;
	}

	.slide-intro {
		width: 100%;
		padding: rem-calc(40 16);
		background-color: $white;
		height: 100%;
		display: flex;
		justify-content: center;
		flex-direction: column;

		@include bp($md) {
			padding: rem-calc(40 80);
		}

		@include bp($lg) {
			z-index: 10;
			position: absolute;
			left: rem-calc(30);
			top: rem-calc(0);
			width: 40%;
			padding: rem-calc(40 55);
		}

		@include bp($xl) {
			width: 43%;
		}

		@include bp($xxl) {
			padding: rem-calc(40 100);
		}

		&__overline {
			text-wrap: auto;
			font-weight: 500;
			font-size: rem-calc(16);
			color: $prussian-blue;
			margin-bottom: rem-calc(6);
			line-height: rem-calc(20);
			text-transform: uppercase;
		}
		&__content {
			h2 {
				@include fluid-type(28, 32);
				@include bp($xl) {
					@include fluid-type(28, 48);
				}
			}
		}
		&__search {
			@include bp($lg) {
				width: 80%;
			}
		}
		&__cta {
			margin-top: 1rem;
			font-size: 14px;

			a {
				color: #552E91;
			}
		}
	}

	.swiper-wrapper {
		transition-timing-function: linear;
	}

    .swiper-slide {
		width: rem-calc(253);
		@include bp($lg) {
			width: rem-calc(464);
		}
        &__inner {
            min-height: rem-calc(232);
            position: relative;
			z-index: 1;

			@include bp($md) {
				min-height: rem-calc(700);
			}
        }

		img {
			object-fit: cover;
		}
    }



	@include slider-navigation;

	.slider-navigation {
		position: absolute;
		top: 50%;
		padding: 0;
		z-index: 20;
		transform: translateY(-50%);
		margin-top:0;
		border:none;
		right: 0;
		width: auto;
	}

	.slider-navigation {
		.slider-button {
			height: rem-calc(165);
			width: rem-calc(45);
			padding: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			transition: background-color 0.3s ease-in-out;
			&:hover {
				background-color: $indigo;
			}
			&--prev {
				position: absolute;
				left:0;
			}
			&--next {
				svg {
					width: rem-calc(15) !important;
					height: rem-calc(29) !important;
				}
			}
		}
	}
}
import STQ_LocationSearch from '../../resources/js/classes/LocationSearch';

class LocalFirmCarousel {
    block;

	constructor(block) {
		this.block = block;
		this.init();
	}

	init() {

		this.swiperElem = this.block.querySelector('.swiper-container');
		this.prevBtnElem = this.block.querySelector('.slider-button--prev');
		this.nextBtnElem = this.block.querySelector('.slider-button--next');

		this.swiper = new Swiper(this.swiperElem, {
			navigation: {
				nextEl: this.nextBtnElem,
				prevEl: this.prevBtnElem
			},
            // slidesPerView: 1.25,
            spaceBetween: 24,
			loop: true,
			autoplay: {
				delay: 0, // No delay between transitions
				disableOnInteraction: false,
			},
			centeredSlides: true,
			centerInsufficientSlides: true,
			speed: 6000,
			slidesPerView: 'auto'
            // breakpoints: {
            //     541: {
            //         slidesPerView: 2.5,
            //     },
            //     1025: {
            //         slidesPerView: 3.5
            //     },
			// 	1200: {
            //         slidesPerView: auto
            //     },
            // },

		});

		new STQ_LocationSearch();
	}
}

document.addEventListener('DOMContentLoaded', () => {
	document.querySelectorAll('.block-local-firm-carousel').forEach((block) => {
		new LocalFirmCarousel(block);
	})
});
{
    "$schema": "https://schemas.wp.org/trunk/block.json",
    "apiVersion": 2,
    "name": "strategiq/local-firm-carousel",
    "title": "Local Firm Carousel",
    "description": "A carousel of firm locations",
    "category": "strategiq",
    "icon": "strategiq",
    "acf": {
        "mode": "preview",
        "renderTemplate": "block-local-firm-carousel.php"
    },
    "supports": {
        "anchor": true,
        "align": false,
        "color": {
            "background": false,
            "text": false,
            "gradients": false
        },
        "spacing": {
            "padding": [
                "top",
                "bottom"
            ],
            "margin": [
                "top",
                "bottom"
            ]
        }
    },
    "example": {
        "attributes": {
            "mode": "preview",
            "data": {
                "heading_type": "h2",
                "heading_text": "Example - Local Firm Carousel",
                "content": "This is some example content to represent what the content will look like"
            }
        }
    },
    "style": ["file:../../assets/css/local-firm-carousel/block-local-firm-carousel.css", "swiper-css"],
    "viewScript": ["swiper-js", "local-firm-carousel"]
}
This component is not currently used on any pages.
There are is no readme file with this component.