i generated an bottom sticky menu with svelteKit. When clicked an menu, its element toggling animate classes using animate.style library. Its working, how to refactor this code?
<script>
import { getStores, navigating, page, session, updated } from '$app/stores';
export let activeMenu;
const animates = {'home': false, 'menu': false, 'profile': false, 'messages': false, 'notifications': false};
function setAnimate(target){
animates[target] = false;
setTimeout(function(){
animates[target] = true;
}, 1000);
}
</script>
<section class="w-100 bottom">
<div class="elem {activeMenu === 'home' ? 'active' : ''}">
<a class="{animates.home === true ? 'animate__animated animate__jello' : ''}" on:click={() => setAnimate('home')} href="/" title="Home"><span class="lnr lnr-home"></span></a>
</div>
<div class="elem {activeMenu === 'notifications' ? 'active' : ''}">
<a class="{animates.notifications === true ? 'animate__animated animate__jello' : ''}" on:click={() => setAnimate('notifications')} title="Notifications"><span class="lnr lnr-alarm"></span></a>
</div>
<div class="elem {activeMenu === 'messages' ? 'active' : ''}">
<a class="{animates.messages === true ? 'animate__animated animate__jello' : ''}" on:click={() => setAnimate('messages')} title="Home"><span class="lnr lnr-envelope"></span></a>
</div>
<div class="elem {activeMenu === 'profile' ? 'active' : ''}">
<a class="{animates.profile === true ? 'animate__animated animate__jello' : ''}" on:click={() => setAnimate('profile')} href="/profile" title="Home"><span class="lnr lnr-user"></span></a>
</div>
<div class="elem {activeMenu === 'menu' ? 'active' : ''}">
<a class="{animates.menu === true ? 'animate__animated animate__jello' : ''}" on:click={() => setAnimate('menu')} href="/menu" title="Home"><span class="lnr lnr-menu"></span></a>
</div>
</section>