<div class="legends-squad-filter-menu" data-behaviour="legends-squad-filter-menu">
<div class="legends-squad-filter-menu__cancel">
<div class="filter-text">Adjust Filters</div>
<div class="close-filter">Cancel</div>
<div class="back-filter">Back</div>
</div>
<div class="legends-squad-filter-menu__filter-scroll">
<div class="legends-squad-filter-menu__filter-section">
<div class="legends-squad-filter-menu__filter-section--list" id="all-squads">
<a class="legends-squad-filter-menu__filter-section--squadlist squads-list squads-next">
<div>
<div class="filterby">Filter by Squad</div>
<div class="filtercontent">
<div class="title" id="getcheckedsquad">All Squads</div>
<div class="filtersquadscount">+<span id="filtersquadsnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-squads squads-line"></div>
</div>
<div class="legends-squad-filter-menu__filter-section--list" id="all-genders">
<a class="legends-squad-filter-menu__filter-section--squadlist genders-list genders-next">
<div>
<div class="filterby">Filter by Gender</div>
<div class="filtercontent">
<div class="title" id="getcheckedgender">All Genders</div>
<div class="filtergenderscount">+<span id="filtergendersnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-genders genders-line"></div>
</div>
<div class="legends-squad-filter-menu__filter-section--list" id="all-positions">
<a class="legends-squad-filter-menu__filter-section--squadlist positions-list positions-next">
<div>
<div class="filterby">Filter by Positions</div>
<div class="filtercontent">
<div class="title" id="getcheckedpositions">All Positions</div>
<div class="filterpositionscount">+<span id="filterpositionsnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-positions positions-line"></div>
</div>
</div>
<div class="legends-squad-filter-menu__filter-options">
<div class="legends-squad-filter-menu__filter-options--buttons" id=all-squads-filter>
<div class="filter-buttons">
<input type="checkbox" class="allsquadsfilter" id="allsquad" value="allsquad">
<label for="allsquad">All Squads</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allsquadsfilter" id="menssenior" value="menssenior">
<label for="menssenior">Mens Senior</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allsquadsfilter" id="womenssenior" value="womenssenior">
<label for="womenssenior">Womens Senior</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allsquadsfilter" id="para" value="para">
<label for="para">Para</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allsquadsfilter" id="futsal" value="futsal">
<label for="futsal">futsal</label>
</div>
<div class="line"></div>
</div>
<div class="legends-squad-filter-menu__filter-options--buttons" id=all-genders-filter>
<div class="filter-buttons">
<input type="checkbox" class="allgendersfilter" id="allgenders" value="allgenders">
<label for="allgenders">All Genders</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allgendersfilter" id="male" value="male">
<label for="male">Male</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allgendersfilter" id="female" value="female">
<label for="female">Female</label>
</div>
<div class="line"></div>
</div>
<div class="legends-squad-filter-menu__filter-options--buttons" id=all-positions-filter>
<div class="filter-buttons">
<input type="checkbox" class="allpositionsfilter" id="allpositions" value="allpositions">
<label for="allpositions">All Positions</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allpositionsfilter" id="goalkeeper" value="goalkeeper">
<label for="goalkeeper">Goalkeeper</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allpositionsfilter" id="defender" value="defender">
<label for="defender">Defender</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allpositionsfilter" id="midfielder" value="midfielder">
<label for="midfielder">Midfielder</label>
</div>
<div class="line"></div>
<div class="filter-buttons">
<input type="checkbox" class="allpositionsfilter" id="forward" value="forward">
<label for="forward">Forward</label>
</div>
<div class="line"></div>
</div>
</div>
</div>
<div class="legends-squad-filter-menu__button-group">
<div class="legends-squad-filter-menu__button-group--results">
<a class="result" href="#legends-squad-list">Show Me <span id="showmeresult"></span><span> Results</span></a>
<div class="filter reset-filter">Reset Filters</div>
</div>
<div class="legends-squad-filter-menu__button-group--apply-filter">
<a class="result apply-filters" href="#legends-squad-list"> Apply Filters </a>
</div>
</div>
</div>
No notes defined.
{
"filters": [
{
"squad": "all-squads-filter",
"list": [
{
"title": "All Squads",
"filters": "allsquad",
"filterby": "allsquadsfilter"
},
{
"title": "Mens Senior",
"filters": "menssenior",
"filterby": "allsquadsfilter"
},
{
"title": "Womens Senior",
"filters": "womenssenior",
"filterby": "allsquadsfilter"
},
{
"title": "Para",
"filters": "para",
"filterby": "allsquadsfilter"
},
{
"title": "futsal",
"filters": "futsal",
"filterby": "allsquadsfilter"
}
]
},
{
"squad": "all-genders-filter",
"list": [
{
"title": "All Genders",
"filters": "allgenders",
"filterby": "allgendersfilter"
},
{
"title": "Male",
"filters": "male",
"filterby": "allgendersfilter"
},
{
"title": "Female",
"filters": "female",
"filterby": "allgendersfilter"
}
]
},
{
"squad": "all-positions-filter",
"list": [
{
"title": "All Positions",
"filters": "allpositions",
"filterby": "allpositionsfilter"
},
{
"title": "Goalkeeper",
"filters": "goalkeeper",
"filterby": "allpositionsfilter"
},
{
"title": "Defender",
"filters": "defender",
"filterby": "allpositionsfilter"
},
{
"title": "Midfielder",
"filters": "midfielder",
"filterby": "allpositionsfilter"
},
{
"title": "Forward",
"filters": "forward",
"filterby": "allpositionsfilter"
}
]
}
]
}
import Glider from '../../behaviours/carousel/glider/glider';
/*eslint-disable */
const filtersquadEvents = parentElement => {
const allCards = document.querySelectorAll('[data-filter]');
const applysquad = parentElement.querySelector('.apply-filters');
const resetfilter = parentElement.querySelector('.reset-filter');
function showChecked() {
document.getElementById('number').innerHTML = document.querySelectorAll(
'input:checked'
).length;
}
function selectedcardcount() {
const divselectedcount = document.querySelectorAll('.legend-player-count');
const cardselectedCount = [].slice.call(divselectedcount);
const cardactiveCount = cardselectedCount.filter(function(el) {
return el.style.display !== 'none';
});
document.getElementById('showmeresult').innerHTML = cardactiveCount.length;
}
function checkedgetsquadlabel({ getsquadlabel }) {
const getvaluesquad = getsquadlabel[0];
if (getsquadlabel.length === 0) {
document.getElementById('getcheckedsquad').innerText = 'All Squads';
} else if (getsquadlabel.length === 1) {
document.getElementById('getcheckedsquad').innerText = getvaluesquad;
document.querySelector('.filtersquadscount').style.display = 'none';
} else {
document.getElementById('getcheckedsquad').innerText = getvaluesquad;
document.querySelector('.filtersquadscount').style.display = 'block';
document.getElementById('filtersquadsnumber').innerText =
getsquadlabel.length - 1;
}
}
function checkedgetgenderlabel({ getgenderlabel }) {
const getvaluegender = getgenderlabel[0];
if (getgenderlabel.length === 0) {
document.getElementById('getcheckedgender').innerText = 'All Genders';
} else if (getgenderlabel.length === 1) {
document.getElementById('getcheckedgender').innerText = getvaluegender;
document.querySelector('.filtergenderscount').style.display = 'none';
} else {
document.getElementById('getcheckedgender').innerText = getvaluegender;
document.querySelector('.filtergenderscount').style.display = 'block';
document.getElementById('filtergendersnumber').innerText =
getgenderlabel.length - 1;
}
}
function checkedgetpositionslabel({ getpositionslabel }) {
const getvaluepositions = getpositionslabel[0];
if (getpositionslabel.length === 0) {
document.getElementById('getcheckedpositions').innerText =
'All Positions';
} else if (getpositionslabel.length === 1) {
document.getElementById(
'getcheckedpositions'
).innerText = getvaluepositions;
document.querySelector('.filterpositionscount').style.display = 'none';
} else {
document.getElementById(
'getcheckedpositions'
).innerText = getvaluepositions;
document.querySelector('.filterpositionscount').style.display = 'block';
document.getElementById('filterpositionsnumber').innerText =
getpositionslabel.length - 1;
}
}
function getcheckedfilter() {
const checkedsquadfilter = document.querySelectorAll('.allsquadsfilter');
const checkedgenderfilter = document.querySelectorAll('.allgendersfilter');
const checkedpositionsfilter = document.querySelectorAll(
'.allpositionsfilter'
);
const squadfilteredValue = [];
const genderfilteredValue = [];
const positionsfilteredValue = [];
for (let i = 0; i < checkedsquadfilter.length; i++) {
if (checkedsquadfilter[i].checked) {
squadfilteredValue.push(
checkedsquadfilter[i].nextElementSibling.textContent
);
}
}
for (let i = 0; i < checkedgenderfilter.length; i++) {
if (checkedgenderfilter[i].checked) {
genderfilteredValue.push(
checkedgenderfilter[i].nextElementSibling.textContent
);
}
}
for (let i = 0; i < checkedpositionsfilter.length; i++) {
if (checkedpositionsfilter[i].checked) {
positionsfilteredValue.push(
checkedpositionsfilter[i].nextElementSibling.textContent
);
}
}
checkedgetsquadlabel({
getsquadlabel: squadfilteredValue,
});
checkedgetgenderlabel({
getgenderlabel: genderfilteredValue,
});
checkedgetpositionslabel({
getpositionslabel: positionsfilteredValue,
});
}
function toggleCheckbox({ currentValue }) {
allCards.forEach(filtercard => {
const currentCardFilterData = JSON.parse(filtercard.dataset.filter);
for (const filterdata in currentCardFilterData) {
if (
currentValue.find(
val =>
val === filterdata && currentCardFilterData[filterdata] === true
)
) {
filtercard.style.removeProperty('display');
break;
} else {
filtercard.style.setProperty('display', 'none');
}
}
});
selectedcardcount();
getcheckedfilter();
}
function resetCards(resetValue) {
const resetcards = document.querySelectorAll('[data-filter]');
if (resetValue.length === undefined) {
for (let i = 0; i < resetcards.length; i += 1) {
resetcards[i].style.display = 'flex';
}
}
selectedcardcount();
}
applysquad.onclick = function getChecked() {
const selectedValue = [];
const checkboxes = parentElement.querySelectorAll('input[type=checkbox]');
for (let i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) {
selectedValue.push(checkboxes[i].value);
}
}
showChecked();
toggleCheckbox({
currentValue: selectedValue,
});
};
resetfilter.onclick = function getChecked() {
const unselectedValue = [];
const reset = parentElement.querySelectorAll('input[type=checkbox]');
for (let i = 0; i < reset.length; i++) {
if (reset[i].checked) {
reset[i].checked = false;
}
}
showChecked();
resetCards({
resetValue: unselectedValue,
});
document.getElementById('getcheckedsquad').innerText = 'All Squads';
document.getElementById('getcheckedgender').innerText = 'All Genders';
document.getElementById('getcheckedpositions').innerText = 'All Positions';
document.querySelector('.filtersquadscount').style.display = 'none';
document.querySelector('.filtergenderscount').style.display = 'none';
document.querySelector('.filterpositionscount').style.display = 'none';
};
};
const filtersectionEvents = parentElement => {
const allsquad = parentElement.querySelector('#all-squads');
const allgender = parentElement.querySelector('#all-genders');
const allposition = parentElement.querySelector('#all-positions');
const backfilter = parentElement.querySelector('.back-filter');
const applyfilter = parentElement.querySelector('.apply-filters');
const closefilter = parentElement.querySelector('.close-filter');
const resultfilter = parentElement.querySelector('.result');
function showAllSquad() {
document.getElementById('all-squads-filter').style.display = 'block';
document.getElementById('all-genders-filter').style.display = 'none';
document.getElementById('all-positions-filter').style.display = 'none';
document.getElementById('all-genders').style.display = 'none';
document.getElementById('all-positions').style.display = 'none';
document.querySelector('.back-filter').style.display = 'flex';
document.querySelector('.close-filter').style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--results'
).style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--apply-filter'
).style.display = 'block';
document.querySelector('.filter-squads').classList.add('active-line');
document.querySelector('.filter-squads').classList.remove('squads-line');
document.querySelector('.squads-list').classList.remove('squads-next');
}
function showAllGender() {
document.getElementById('all-squads-filter').style.display = 'none';
document.getElementById('all-genders-filter').style.display = 'block';
document.getElementById('all-positions-filter').style.display = 'none';
document.getElementById('all-squads').style.display = 'none';
document.getElementById('all-positions').style.display = 'none';
document.querySelector('.back-filter').style.display = 'flex';
document.querySelector('.close-filter').style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--results'
).style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--apply-filter'
).style.display = 'block';
document.querySelector('.filter-genders').classList.add('active-line');
document.querySelector('.filter-genders').classList.remove('genders-line');
document.querySelector('.genders-list').classList.remove('genders-next');
}
function showAllPositions() {
document.getElementById('all-squads-filter').style.display = 'none';
document.getElementById('all-genders-filter').style.display = 'none';
document.getElementById('all-positions-filter').style.display = 'block';
document.getElementById('all-squads').style.display = 'none';
document.getElementById('all-genders').style.display = 'none';
document.querySelector('.back-filter').style.display = 'flex';
document.querySelector('.close-filter').style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--results'
).style.display = 'none';
document.querySelector(
'.legends-squad-filter-menu__button-group--apply-filter'
).style.display = 'block';
document.querySelector('.filter-positions').classList.add('active-line');
document
.querySelector('.filter-positions')
.classList.remove('positions-line');
document
.querySelector('.positions-list')
.classList.remove('positions-next');
}
function closeAllSquad() {
document.getElementById('all-squads-filter').style.display = 'none';
document.getElementById('all-genders-filter').style.display = 'none';
document.getElementById('all-positions-filter').style.display = 'none';
document.getElementById('all-squads').style.display = 'block';
document.getElementById('all-genders').style.display = 'block';
document.getElementById('all-positions').style.display = 'block';
document.querySelector('.back-filter').style.display = 'none';
document.querySelector('.close-filter').style.display = 'flex';
document.querySelector(
'.legends-squad-filter-menu__button-group--results'
).style.display = 'flex';
document.querySelector(
'.legends-squad-filter-menu__button-group--apply-filter'
).style.display = 'none';
document.querySelector('.filter-squads').classList.add('squads-line');
document.querySelector('.filter-genders').classList.add('genders-line');
document.querySelector('.filter-positions').classList.add('positions-line');
document.querySelector('.filter-squads').classList.remove('active-line');
document.querySelector('.filter-genders').classList.remove('active-line');
document.querySelector('.filter-positions').classList.remove('active-line');
document.querySelector('.squads-list').classList.add('squads-next');
document.querySelector('.genders-list').classList.add('genders-next');
document.querySelector('.positions-list').classList.add('positions-next');
}
function applyFilter() {
document
.querySelector('.legends-squad-filter')
.classList.remove('hide-filter');
document
.querySelector('.legends-squad-filter-menu')
.classList.remove('add-animation');
document.body.classList.remove('dark-overlay');
}
function closeFilter() {
document
.querySelector('.legends-squad-filter')
.classList.remove('hide-filter');
document
.querySelector('.legends-squad-filter-menu')
.classList.remove('add-animation');
document.body.classList.remove('dark-overlay');
}
function resultFilter() {
document
.querySelector('.legends-squad-filter')
.classList.remove('hide-filter');
document
.querySelector('.legends-squad-filter-menu')
.classList.remove('add-animation');
document.body.classList.remove('dark-overlay');
}
allsquad.addEventListener('click', showAllSquad);
allgender.addEventListener('click', showAllGender);
allposition.addEventListener('click', showAllPositions);
backfilter.addEventListener('click', closeAllSquad);
applyfilter.addEventListener('click', applyFilter);
closefilter.addEventListener('click', closeFilter);
resultfilter.addEventListener('click', resultFilter);
};
const disablefilter = () => {
const disableCards = document.querySelectorAll('[data-filter]');
const selecteachsquadfilters = document.querySelectorAll(
'#all-squads-filter input'
);
const firstelementsquad = selecteachsquadfilters[0];
const selecteachgenderfilters = document.querySelectorAll(
'#all-genders-filter input'
);
const firstelementgender = selecteachgenderfilters[0];
const selecteachpositionfilters = document.querySelectorAll(
'#all-positions-filter input'
);
const firstelementposition = selecteachpositionfilters[0];
selecteachsquadfilters.forEach(selecteachsquadfilter => {
selecteachsquadfilter.addEventListener('click', function() {
const firstfiltersquad = [].slice.call(selecteachsquadfilters, 1);
if (selecteachsquadfilter.id === firstelementsquad.id) {
for (let i = 0; i < firstfiltersquad.length; i++) {
firstfiltersquad[i].checked = false;
}
} else {
firstelementsquad.checked = false;
}
});
});
selecteachgenderfilters.forEach(selecteachgenderfilter => {
selecteachgenderfilter.addEventListener('click', function() {
const firstfiltergender = [].slice.call(selecteachgenderfilters, 1);
if (selecteachgenderfilter.id === firstelementgender.id) {
for (let i = 0; i < firstfiltergender.length; i++) {
firstfiltergender[i].checked = false;
}
} else {
firstelementgender.checked = false;
}
});
});
selecteachpositionfilters.forEach(selecteachpositionfilter => {
selecteachpositionfilter.addEventListener('click', function() {
const firstfilterposition = [].slice.call(selecteachpositionfilters, 1);
if (selecteachpositionfilter.id === firstelementposition.id) {
for (let i = 0; i < firstfilterposition.length; i++) {
firstfilterposition[i].checked = false;
}
} else {
firstelementposition.checked = false;
}
});
});
window.onload = function() {
const cardCount = document.querySelectorAll('.legend-player-count').length;
document.getElementById('showmeresult').innerHTML = cardCount;
const filteroptions = document.querySelectorAll('input[type=checkbox]');
for (let i = 0; i < filteroptions.length; i++) {
filteroptions[i].disabled = true;
filteroptions[i].classList.add('disable-buttons');
}
disableCards.forEach(filtercard => {
const currentCardDisableData = JSON.parse(filtercard.dataset.filter);
Object.keys(currentCardDisableData).forEach(filterdata => {
if (currentCardDisableData[filterdata] === true) {
document.querySelector(`#${filterdata}`).disabled = false;
document
.querySelector(`#${filterdata}`)
.classList.remove('disable-buttons');
}
});
});
};
};
const getLegendsCarouselElement = legendsElement => {
if (!legendsElement) {
return false;
}
const carouselId = legendsElement.getAttribute('data-legends-attr');
const carouselElement = document.querySelector(
`[data-carousel-attr=carousel-${carouselId}]`
);
return carouselElement;
};
const setUpLegendsGlider = ({ curouselElement }) => {
const navElement = getLegendsCarouselElement(curouselElement);
const curoselObj = curouselElement;
if (!navElement) {
return false;
}
const prevButton = navElement.querySelector('.tabbed-carousel__prev');
const nextButton = navElement.querySelector('.tabbed-carousel__next');
const pagination = navElement.querySelector('.tabbed-carousel__pagination');
const defaultSettings = {
slidesToShow: 1,
slidesToScroll: 1,
scrollLock: true,
draggable: true,
arrows: {
prev: prevButton,
next: nextButton,
},
dots: pagination,
responsive: [
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 900,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 1200,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
};
// When our tabs are changed we destroy the current carousel and create a new one.
// However, we want to be able to reuse the arrows for the new carousel, but glider
// does not properly detach events when a carousel is destroyed. To get around this we are
// listening for the destroy event, removing the current arrows (with events attached) and
// replacing them with new ones so that, when a new carousel is created it has the correct
// events attached.
curouselElement.addEventListener('glider-destroy', () => {
const arrowContainer = navElement.querySelector(
'.tabbed-carousel__arrows-wrap'
);
[prevButton, nextButton].forEach(button => {
const clone = button.cloneNode(true);
arrowContainer.appendChild(clone);
button.remove();
});
});
// added condtion to hide pagination when only one page available
if (curoselObj.children.length < 2) {
// eslint-disable-next-line no-param-reassign
navElement.querySelector('.carousel-nav-block').style.display = 'none';
} else {
// eslint-disable-next-line no-param-reassign
navElement.querySelector('.carousel-nav-block').style.display = 'block';
}
return new Glider(curouselElement, {
...defaultSettings,
});
};
const dynamicCarousel = () => {
const allLegendsGroup = document.querySelectorAll('[data-legends-attr]');
allLegendsGroup.forEach(group => {
let divs = group.querySelectorAll('.legends-player-profile');
let newDivs = Array.from(divs);
let curouselDiv = '';
for (let i = 0; i < newDivs.length; i += 4) {
// console.log(i);
if (i + 4 <= newDivs.length && newDivs.length >= 4) {
curouselDiv += `<div class="new">${newDivs[i].outerHTML}`;
curouselDiv += newDivs[i + 1].outerHTML;
curouselDiv += newDivs[i + 2].outerHTML;
curouselDiv += newDivs[i + 3].outerHTML;
curouselDiv += `</div>`;
if (newDivs.length > 4) {
curouselDiv += `<div class="new">`;
}
} else if (newDivs.length <= 4) {
curouselDiv += `<div class="new">${newDivs[i].outerHTML}`;
if (newDivs[i + 1]) {
curouselDiv += newDivs[i + 1].outerHTML;
}
if (newDivs[i + 2]) {
curouselDiv += newDivs[i + 2].outerHTML;
}
curouselDiv += `</div>`;
} else {
if (newDivs[i - 3] && i + 3 < newDivs.length) {
curouselDiv += newDivs[i - 3].outerHTML;
}
if (newDivs[i - 2] && i + 2 < newDivs.length) {
curouselDiv += newDivs[i - 2].outerHTML;
}
curouselDiv += `${newDivs[newDivs.length - 1].outerHTML}</div>`;
}
}
group.innerHTML = curouselDiv;
});
const allCarouselElements = document.querySelectorAll('[data-legends-attr]');
const allCarousel = [];
allCarouselElements.forEach(curouselElement => {
let carouselId = curouselElement.getAttribute('data-legends-attr');
allCarousel[carouselId] = setUpLegendsGlider({ curouselElement });
allCarousel[carouselId].updateControls();
});
};
export default parentElement => {
filtersquadEvents(parentElement);
filtersectionEvents(parentElement);
disablefilter(parentElement);
// window.addEventListener('resize', () => resizeRecentPlayerBlock());
if (window.innerWidth < 820) {
dynamicCarousel();
} else {
const allCarouselElements = document.querySelectorAll(
'[data-carousel-attr]'
);
allCarouselElements.forEach(navElement => {
navElement.querySelector('.carousel-nav-block').style.display = 'none';
});
}
document.addEventListener('click', (e) => {
if(!(e.target.closest('.legends-squad-filter-menu') || e.target.closest('.legends-squad-filter'))) {
document
.querySelector('.legends-squad-filter')
.classList.remove('hide-filter');
document
.querySelector('.legends-squad-filter-menu')
.classList.remove('add-animation');
document.body.classList.remove('dark-overlay');
}
});
};
.legends-squad-filter-menu {
background: $black;
height: 100%;
width: 37.5rem;
visibility: hidden;
top: 0;
left: -37.5rem;
overflow: hidden;
position: fixed;
z-index: 110;
opacity: 0;
transition: all 0.25s;
-webkit-transition: all 0.25s;
&.add-animation {
visibility: visible;
opacity: 1;
left: 0;
}
&__cancel {
background: $white;
display: flex;
align-items: center;
justify-content: space-between;
padding: 2.3rem 2rem 1.6rem 2.6rem;
.filter-text {
font-family: $text-font;
font-size: 1.6rem;
line-height: 2.4rem;
color: $black;
}
.close-filter {
font-family: $text-font;
font-size: 1.4rem;
line-height: 2.4rem;
color: $color-interface-light;
display: flex;
cursor: pointer;
&::after {
content: '';
background: url(./assets/images/icon-close.svg) no-repeat center;
display: inline-block;
width: 2rem;
height: 2rem;
margin-left: 1.6rem;
position: relative;
top: -4px;
}
}
.back-filter {
font-family: $text-font;
font-size: 1.4rem;
line-height: 2.4rem;
color: $blue;
display: none;
cursor: pointer;
&::before {
content: '';
background: url(./assets/images/arrow-back.svg) no-repeat center;
display: inline-block;
width: 2rem;
height: 2rem;
margin-right: 1.4rem;
}
}
}
&__filter-section {
&--squadlist {
display: flex;
justify-content: space-between;
padding: 2rem 3.3rem 1rem 2.6rem;
.filterby {
font-size: 1.2rem;
line-height: 1.2rem;
font-family: $text-font;
text-transform: capitalize;
color: $white;
opacity: 0.7;
text-decoration: none;
}
.title {
font-size: 1.8rem;
line-height: 4rem;
font-family: $text-font;
letter-spacing: -0.01em;
color: $white;
text-decoration: none;
}
.filtercontent {
display: flex;
align-items: center;
}
.filtersquadscount,
.filtergenderscount,
.filterpositionscount {
display: none;
font-size: 2rem;
line-height: 4rem;
font-family: $text-font;
letter-spacing: -0.01em;
color: $white;
text-decoration: none;
padding-left: 0.5rem;
span {
padding: 0 0.5rem;
}
}
}
.squads-next,
.genders-next,
.positions-next {
&::after {
content: '';
background: url(./assets/images/arrow-next-white.svg) no-repeat center;
display: inline-block;
width: 2rem;
height: 2rem;
margin-top: 1rem;
-webkit-transition: transform 0.3s ease-out;
-moz-transition: transform 0.3s ease-out;
-ms-transition: transform 0.3s ease-out;
-o-transition: transform 0.3s ease-out;
transition: transform 0.3s ease-out;
}
}
&--list {
cursor: pointer;
transition: 0.5s;
.squads-line,
.genders-line,
.positions-line {
background: $grey-light;
opacity: 0.2;
height: 0.1rem;
margin-right: 0.5rem;
transition: 0.3s;
}
.active-line {
position: relative;
&::after {
content: '';
background: $brown;
opacity: 0.9;
height: 0.3rem;
position: absolute;
margin: 0 auto;
left: 1.6rem;
right: 1.6rem;
}
}
&:hover .title {
font-weight: bold;
}
&:hover .squads-line,
&:hover .genders-line,
&:hover .positions-line {
opacity: 0.7;
}
&:hover .legends-squad-filter-menu__filter-section--squadlist {
&:hover {
&::after {
-webkit-transform: translateX(0.8rem);
-moz-transform: translateX(0.8rem);
-ms-transform: translateX(0.8rem);
-o-transform: translateX(0.8rem);
transform: translateX(0.8rem);
}
}
}
}
}
&__button-group {
position: absolute;
bottom: 2.4rem;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
background: $black;
&--results {
display: flex;
align-items: center;
column-gap: 2rem;
.result {
background: $brown;
border-radius: 0.2rem;
width: 16rem;
height: 4.4rem;
color: $white;
padding: 1.6rem 1.2rem 1.4rem 1.2rem;
font-family: $text-font;
font-size: 1.2rem;
line-height: 1.4rem;
text-align: center;
letter-spacing: 0.01em;
text-transform: uppercase;
text-decoration: none;
display: block;
cursor: pointer;
span {
font-weight: bold;
letter-spacing: 0.06em;
&:first-child {
margin-left: 0.3rem;
}
}
}
.filter {
width: 16rem;
height: 4.4rem;
color: $color-interface-light;
padding: 1.6rem 1.2rem 1.4rem 1.2rem;
font-family: $text-font;
font-size: 1.2rem;
line-height: 1.4rem;
text-align: center;
letter-spacing: 0.01em;
background: $white;
border: 0.1rem solid $blue;
box-sizing: border-box;
border-radius: 0.2rem;
text-transform: uppercase;
cursor: pointer;
}
}
&--apply-filter {
display: none;
.result {
background: $brown;
border-radius: 0.2rem;
width: 33.5rem;
height: 4.4rem;
color: $white;
padding: 1.6rem 1.2rem 1.4rem 1.2rem;
font-family: $text-font;
font-size: 1.4rem;
line-height: 1.4rem;
text-align: center;
letter-spacing: 0.01em;
text-transform: uppercase;
text-decoration: none;
display: block;
cursor: pointer;
}
}
}
&__filter-options {
overflow-y: scroll;
height: 85vh;
&--buttons {
display: none;
.filter-buttons {
padding: 2rem 3.3rem 2rem 2.6rem;
input {
display: none;
cursor: pointer;
}
label {
position: relative;
cursor: pointer;
display: flex;
font-family: $text-font;
font-style: normal;
font-weight: normal;
font-size: 1.6rem;
line-height: 3rem;
letter-spacing: 0.02em;
color: $white;
justify-content: space-between;
order: 2;
user-select: none;
}
label::before {
content: '';
background: url(./assets/images/filter-selector.svg) no-repeat center;
width: 3rem;
height: 3rem;
padding: 1rem;
display: inline-block;
position: relative;
cursor: pointer;
order: 2;
transition: 0.4s;
}
&:hover label::before {
background: url(./assets/images/filter-selector-hover.svg) no-repeat
center;
width: 3rem;
height: 3rem;
padding: 1rem;
display: inline-block;
position: relative;
cursor: pointer;
}
.disable-buttons + label {
opacity: 0.5;
cursor: default;
}
.disable-buttons + label::before {
display: none;
}
input:checked + label::before {
background: url(./assets/images/filter-selector-selected.svg)
no-repeat center;
width: 3rem;
height: 3rem;
display: inline-block;
position: relative;
cursor: pointer;
order: 1;
}
input:checked + label::after {
content: '';
background: url(./assets/images/filter-selector-tick.svg) no-repeat
center;
width: 1.04rem;
height: 0.88rem;
display: flex;
align-items: center;
justify-content: space-around;
position: absolute;
bottom: 1.2rem;
right: 1rem;
}
}
.line {
background: $grey-light;
opacity: 0.2;
height: 0.1rem;
width: 100%;
}
}
}
&__filter-options::-webkit-scrollbar {
width: 0.2rem;
}
&__filter-options::-webkit-scrollbar-track {
background-color: $black;
-webkit-border-radius: 1rem;
border-radius: 1rem;
}
@media screen and (max-width: $mq-small) {
width: 100%;
}
}
<div class="legends-squad-filter-menu" data-behaviour="legends-squad-filter-menu">
<div class="legends-squad-filter-menu__cancel">
<div class="filter-text">Adjust Filters</div>
<div class="close-filter">Cancel</div>
<div class="back-filter">Back</div>
</div>
<div class="legends-squad-filter-menu__filter-scroll">
<div class="legends-squad-filter-menu__filter-section">
<div class="legends-squad-filter-menu__filter-section--list" id="all-squads">
<a class="legends-squad-filter-menu__filter-section--squadlist squads-list squads-next">
<div>
<div class="filterby">Filter by Squad</div>
<div class="filtercontent">
<div class="title" id="getcheckedsquad">All Squads</div>
<div class="filtersquadscount">+<span id="filtersquadsnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-squads squads-line"></div>
</div>
<div class="legends-squad-filter-menu__filter-section--list" id="all-genders">
<a class="legends-squad-filter-menu__filter-section--squadlist genders-list genders-next">
<div>
<div class="filterby">Filter by Gender</div>
<div class="filtercontent">
<div class="title" id="getcheckedgender">All Genders</div>
<div class="filtergenderscount">+<span id="filtergendersnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-genders genders-line"></div>
</div>
<div class="legends-squad-filter-menu__filter-section--list" id="all-positions">
<a class="legends-squad-filter-menu__filter-section--squadlist positions-list positions-next">
<div>
<div class="filterby">Filter by Positions</div>
<div class="filtercontent">
<div class="title" id="getcheckedpositions">All Positions</div>
<div class="filterpositionscount">+<span id="filterpositionsnumber">1</span>more</div>
</div>
</div>
</a>
<div class="filter-positions positions-line"></div>
</div>
</div>
<div class="legends-squad-filter-menu__filter-options">
{{#each filters}}
<div class="legends-squad-filter-menu__filter-options--buttons" id={{squad}}>
{{#each list}}
<div class="filter-buttons">
<input type="checkbox" class="{{filterby}}" id="{{filters}}" value="{{filters}}">
<label for="{{filters}}">{{title}}</label>
</div>
<div class="line"></div>
{{/each}}
</div>
{{/each}}
</div>
</div>
<div class="legends-squad-filter-menu__button-group">
<div class="legends-squad-filter-menu__button-group--results">
<a class="result" href="#legends-squad-list">Show Me <span id="showmeresult"></span><span> Results</span></a>
<div class="filter reset-filter">Reset Filters</div>
</div>
<div class="legends-squad-filter-menu__button-group--apply-filter">
<a class="result apply-filters" href="#legends-squad-list"> Apply Filters </a>
</div>
</div>
</div>