[WIP] filter btn cox list view
This commit is contained in:
@ -4,9 +4,38 @@ import './scss/app.scss'
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
initSearch();
|
||||
initSidebar();
|
||||
initToggle();
|
||||
});
|
||||
|
||||
function initSearch() {
|
||||
function initToggle() {
|
||||
const toggle = <HTMLInputElement>document.querySelector('#filterdays-js');
|
||||
|
||||
if(toggle) {
|
||||
toggle.addEventListener('click', () => {
|
||||
toggle.ariaPressed = (toggle.ariaPressed === 'true') ? 'false' : 'true';
|
||||
|
||||
const daysNoTrips = document.querySelectorAll('div[data-trips="0"]');
|
||||
Array.prototype.forEach.call(daysNoTrips, (day: HTMLElement) => {
|
||||
day.classList.toggle('hidden');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const coxToggle = <HTMLInputElement>document.querySelector('#filtertrips-js');
|
||||
|
||||
if(coxToggle) {
|
||||
coxToggle.addEventListener('click', () => {
|
||||
coxToggle.ariaPressed = (coxToggle.ariaPressed === 'true') ? 'false' : 'true';
|
||||
|
||||
const noCoxNeeded = document.querySelectorAll('div[data-coxneeded="false"]');
|
||||
Array.prototype.forEach.call(noCoxNeeded, (notNeeded: HTMLElement) => {
|
||||
notNeeded.classList.toggle('hidden');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initSearch() {
|
||||
const input = <HTMLInputElement>document.querySelector('#filter-js');
|
||||
|
||||
if(input) {
|
||||
|
@ -20,4 +20,8 @@
|
||||
&-fw {
|
||||
@apply w-28;
|
||||
}
|
||||
|
||||
&[aria-pressed='true'] {
|
||||
@apply outline outline-2 outline-offset-2 outline-primary-600;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user