1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
import {
animate,
state,
style,
transition,
trigger
} from '@angular/animations';
type PaneType = 'left' | 'right';
@Component({
selector: 'app-slide-panel',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './slide-panel.component.html',
styleUrls: ['./slide-panel.component.scss'],
animations: [
trigger('slide', [
state('left', style({ transform: 'translateX(0)' })),
state('right', style({ transform: 'translateX(-50%)' })),
transition('* => *', animate(300))
])
]
})
export class SlidePanelComponent {
@Input() activePane: PaneType = 'left';
}
|