import { ChangeDetectionStrategy, Component } from '@angular/core';
import {
CanvasSidebarStartUpdateEventDetail,
PorscheDesignSystemModule,
} from '@porsche-design-system/components-angular';
import { breakpointS } from '@porsche-design-system/components-angular/emotion';
@Component({
selector: 'porsche-design-system-app',
styles: [
`
.-col-span-full-1 {
grid-column: 1 / -1;
}
.-col-span-full-2 {
grid-column: 2 / -2;
}
.-col-span-full-3 {
grid-column: 3 / -3;
}
.-col-span-4 {
grid-column: span 4;
}
.tile {
margin-top: 16px;
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
background: lightpink;
}
`,
],
template: `
App Name
Open sidebar
Content
Grid span 4x
Grid span 4x
Grid span 4x
12 Grid columns
10 Grid columns
8 Grid columns
Sidebar End Header
`,
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [PorscheDesignSystemModule],
})
export class ExampleComponent {
// initially, sidebar should be closed on mobile and opened on desktop
isSidebarStartOpen: boolean = window.matchMedia(`(min-width: ${breakpointS}px)`).matches;
isSidebarEndOpen: boolean = false;
onSidebarStartUpdate(e: CustomEvent) {
this.isSidebarStartOpen = e.detail.open;
}
onSidebarEndOpen() {
this.isSidebarEndOpen = true;
}
onSidebarEndDismiss() {
this.isSidebarEndOpen = false;
}
}