Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Deprecate SkySelectionBoxGridAlignItems #281

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import {
} from '../selection-box-grid.component';

import {
SkySelectionBoxGridAlignItems
} from '../types/selection-box-grid-align-items';
SkySelectionBoxGridAlignItemsType
} from '../types/selection-box-grid-align-items-type';

@Component({
selector: 'sky-test-cmp',
templateUrl: './selection-box-grid.component.fixture.html'
})
export class SelectionBoxGridTestComponent {

public alignItems: SkySelectionBoxGridAlignItems;
public alignItems: SkySelectionBoxGridAlignItemsType;

public firstBoxHeight: string = '500px';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import {
SelectionBoxGridTestComponent
} from './fixtures/selection-box-grid.component.fixture';

import {
SkySelectionBoxGridAlignItems
} from './types/selection-box-grid-align-items';

describe('Selection box grid component', () => {

//#region helpers
Expand Down Expand Up @@ -86,15 +82,15 @@ describe('Selection box grid component', () => {
});

it('should set proper CSS classess when alignItems is set to center', () => {
component.alignItems = SkySelectionBoxGridAlignItems.Center;
component.alignItems = 'center';
fixture.detectChanges();

expect(getSelectionBoxGrid()).not.toHaveCssClass('sky-selection-box-grid-align-left');
expect(getSelectionBoxGrid()).toHaveCssClass('sky-selection-box-grid-align-center');
});

it('should set proper CSS classess when alignItems is set to left', () => {
component.alignItems = SkySelectionBoxGridAlignItems.Left;
component.alignItems = 'left';
fixture.detectChanges();

expect(getSelectionBoxGrid()).not.toHaveCssClass('sky-selection-box-grid-align-center');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import {
} from './selection-box-adapter.service';

import {
SkySelectionBoxGridAlignItems
} from './types/selection-box-grid-align-items';
SkySelectionBoxGridAlignItemsType
} from './types/selection-box-grid-align-items-type';

const SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';

Expand All @@ -63,15 +63,15 @@ export class SkySelectionBoxGridComponent implements AfterViewInit, OnDestroy, O
/**
* @internal
* Specifies how to display the selection boxes in the grid.
* @default SkySelectionBoxGridAlignItems.Center
* @default 'center'
*/
@Input()
public set alignItems(value: SkySelectionBoxGridAlignItems) {
public set alignItems(value: SkySelectionBoxGridAlignItemsType) {
this._alignItems = value;
}

public get alignItems(): SkySelectionBoxGridAlignItems {
return this._alignItems || SkySelectionBoxGridAlignItems.Center;
public get alignItems(): SkySelectionBoxGridAlignItemsType {
return this._alignItems || 'center';
}

@ContentChildren(SkySelectionBoxComponent, {
Expand All @@ -97,7 +97,7 @@ export class SkySelectionBoxGridComponent implements AfterViewInit, OnDestroy, O

private ngUnsubscribe = new Subject();

private _alignItems: SkySelectionBoxGridAlignItems;
private _alignItems: SkySelectionBoxGridAlignItemsType;

private _currentBreakpoint: SkyMediaBreakpoints;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @internal
*/
export type SkySelectionBoxGridAlignItemsType = 'center' | 'left';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @internal
* @deprecated Use `SkySelectionBoxGridAlignItemsType` instead.
*/
export const enum SkySelectionBoxGridAlignItems {

Expand Down
1 change: 1 addition & 0 deletions src/app/public/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export * from './modules/radio/types/radio-change';
export * from './modules/radio/radio.module';

export * from './modules/selection-box/types/selection-box-grid-align-items';
export * from './modules/selection-box/types/selection-box-grid-align-items-type';
export * from './modules/selection-box/selection-box.module';

export * from './modules/toggle-switch/types/toggle-switch-change';
Expand Down
10 changes: 5 additions & 5 deletions src/app/visual/selection-box/selection-box-visual.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ import {
} from '@skyux/theme';

import {
SkySelectionBoxGridAlignItems
} from '../../public/public_api';
SkySelectionBoxGridAlignItemsType
} from '../../public/modules/selection-box/types/selection-box-grid-align-items-type';

@Component({
selector: 'selection-box-visual',
templateUrl: './selection-box-visual.component.html'
})
export class SelectionBoxVisualComponent implements OnInit {

public alignItems: SkySelectionBoxGridAlignItems;
public alignItems: SkySelectionBoxGridAlignItemsType;

public items: any[] = [
{
Expand Down Expand Up @@ -83,11 +83,11 @@ export class SelectionBoxVisualComponent implements OnInit {
}

public onCenterAlignClick(): void {
this.alignItems = SkySelectionBoxGridAlignItems.Center;
this.alignItems = 'center';
}

public onLeftAlignClick(): void {
this.alignItems = SkySelectionBoxGridAlignItems.Left;
this.alignItems = 'left';
}

public onSubmit(value: any): void {
Expand Down