I am working on an Angular responsive app, which on mobile it has a drawer.
I love Web Animations API implementation in Angular, but I can't find a place where I can configure animations based on my media-queries breakpoints.
All I can find is canceling the animations via my css sheet, but thats make me start to spread the code on different places in my project, and I'm not sure that this is what angular intended for me to do...
Real life example
My application drawer uses this code to animate
<div class="mobile-menu" [@animateDrawer]="drawerOpened">
<!-- Drawer's menu goes here -->
</div>
drawerOpened
is a boolean that toggle when app menu button is pressed.
My component looks like that:
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
animations: [
trigger('animateDrawer', [
state('inactive', style({
transform: 'translate3d(-100%, 0, 0)'
})),
state('active', style({
transform: 'translate3d(0, 0, 0)'
}))
])
]
})
The CSS code where I cancel the animations effects
.mobile-menu {
opacity: 1 !important;
display: flex !important;
transform: none !important;
}
Besides manipulating all in my css code & disabling the css properties on Desktop BreakPoint, does exist some way to do it inside Angular context?
Thank you!