Skip to content

Commit 0ba32cd

Browse files
authored
refactor(sidebar): remove deprecated properties (#2973)
BREAKING CHANGE: `NbSidebarComponent.toggleResponsive` method removed. Toggle `responsive` property. `NbSidebarComponent`'s `STATE_EXPANDED`, `STATE_COLLAPSED`, `STATE_COMPACTED` static properties removed. Use `NbSidebarState` type values (`'expanded'`, `'collapsed'`, `'compacted'`). `NbSidebarComponent`'s `RESPONSIVE_STATE_MOBILE`, `RESPONSIVE_STATE_TABLET`, `RESPONSIVE_STATE_PC` static properties removed. Use `NbSidebarResponsiveState` type values (`'mobile'`, `'tablet'`, `'pc'`).
1 parent 06f620d commit 0ba32cd

File tree

1 file changed

+13
-57
lines changed

1 file changed

+13
-57
lines changed

src/framework/theme/components/sidebar/sidebar.component.ts

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ export type NbSidebarResponsiveState = 'mobile' | 'tablet' | 'pc';
3535
*/
3636
@Component({
3737
selector: 'nb-sidebar-header',
38-
template: `
39-
<ng-content></ng-content>
40-
`,
38+
template: ` <ng-content></ng-content> `,
4139
})
42-
export class NbSidebarHeaderComponent {
43-
}
40+
export class NbSidebarHeaderComponent {}
4441

4542
/**
4643
* Sidebar footer container.
@@ -50,12 +47,9 @@ export class NbSidebarHeaderComponent {
5047
*/
5148
@Component({
5249
selector: 'nb-sidebar-footer',
53-
template: `
54-
<ng-content></ng-content>
55-
`,
50+
template: ` <ng-content></ng-content> `,
5651
})
57-
export class NbSidebarFooterComponent {
58-
}
52+
export class NbSidebarFooterComponent {}
5953

6054
/**
6155
* Layout sidebar component.
@@ -133,8 +127,7 @@ export class NbSidebarFooterComponent {
133127
selector: 'nb-sidebar',
134128
styleUrls: ['./sidebar.component.scss'],
135129
template: `
136-
<div class="main-container"
137-
[class.main-container-fixed]="containerFixedValue">
130+
<div class="main-container" [class.main-container-fixed]="containerFixedValue">
138131
<ng-content select="nb-sidebar-header"></ng-content>
139132
<div class="scrollable" (click)="onClick($event)">
140133
<ng-content></ng-content>
@@ -145,7 +138,6 @@ export class NbSidebarFooterComponent {
145138
changeDetection: ChangeDetectionStrategy.OnPush,
146139
})
147140
export class NbSidebarComponent implements OnInit, OnDestroy {
148-
149141
protected readonly responsiveValueChange$: Subject<boolean> = new Subject<boolean>();
150142
protected responsiveState: NbSidebarResponsiveState = 'pc';
151143

@@ -319,28 +311,32 @@ export class NbSidebarComponent implements OnInit, OnDestroy {
319311
) {}
320312

321313
ngOnInit() {
322-
this.sidebarService.onToggle()
314+
this.sidebarService
315+
.onToggle()
323316
.pipe(
324317
filter(({ tag }) => !this.tag || this.tag === tag),
325318
takeUntil(this.destroy$),
326319
)
327320
.subscribe(({ compact }) => this.toggle(compact));
328321

329-
this.sidebarService.onExpand()
322+
this.sidebarService
323+
.onExpand()
330324
.pipe(
331325
filter(({ tag }) => !this.tag || this.tag === tag),
332326
takeUntil(this.destroy$),
333327
)
334328
.subscribe(() => this.expand());
335329

336-
this.sidebarService.onCollapse()
330+
this.sidebarService
331+
.onCollapse()
337332
.pipe(
338333
filter(({ tag }) => !this.tag || this.tag === tag),
339334
takeUntil(this.destroy$),
340335
)
341336
.subscribe(() => this.collapse());
342337

343-
this.sidebarService.onCompact()
338+
this.sidebarService
339+
.onCompact()
344340
.pipe(
345341
filter(({ tag }) => !this.tag || this.tag === tag),
346342
takeUntil(this.destroy$),
@@ -446,7 +442,6 @@ export class NbSidebarComponent implements OnInit, OnDestroy {
446442
takeUntil(this.destroy$),
447443
)
448444
.subscribe(([prev, current]: [NbMediaBreakpoint, NbMediaBreakpoint]) => {
449-
450445
const isCollapsed = this.collapsedBreakpoints.includes(current.name);
451446
const isCompacted = this.compactedBreakpoints.includes(current.name);
452447

@@ -495,43 +490,4 @@ export class NbSidebarComponent implements OnInit, OnDestroy {
495490
this.cd.markForCheck();
496491
}
497492
}
498-
499-
/**
500-
* @deprecated Use `responsive` property instead
501-
* @breaking-change Remove @8.0.0
502-
*/
503-
toggleResponsive(enabled: boolean) {
504-
this.responsive = enabled;
505-
}
506-
/**
507-
* @deprecated Use NbSidebarState type instead
508-
* @breaking-change Remove @8.0.0
509-
*/
510-
static readonly STATE_EXPANDED: string = 'expanded';
511-
/**
512-
* @deprecated Use NbSidebarState type instead
513-
* @breaking-change Remove @8.0.0
514-
*/
515-
static readonly STATE_COLLAPSED: string = 'collapsed';
516-
/**
517-
* @deprecated Use NbSidebarState type instead
518-
* @breaking-change Remove @8.0.0
519-
*/
520-
static readonly STATE_COMPACTED: string = 'compacted';
521-
522-
/**
523-
* @deprecated Use NbSidebarResponsiveState type instead
524-
* @breaking-change Remove @8.0.0
525-
*/
526-
static readonly RESPONSIVE_STATE_MOBILE: string = 'mobile';
527-
/**
528-
* @deprecated Use NbSidebarResponsiveState type instead
529-
* @breaking-change Remove @8.0.0
530-
*/
531-
static readonly RESPONSIVE_STATE_TABLET: string = 'tablet';
532-
/**
533-
* @deprecated Use NbSidebarResponsiveState type instead
534-
* @breaking-change Remove @8.0.0
535-
*/
536-
static readonly RESPONSIVE_STATE_PC: string = 'pc';
537493
}

0 commit comments

Comments
 (0)