Skip to content

Commit

Permalink
feat(design)!: remove deprecated layout and size properties in `D…
Browse files Browse the repository at this point in the history
…affCalloutComponent` (#2869)

BREAKING CHANGE: `layout` and `size` have been removed from the codebase. Use `textAlignment` and `compact` instead.
  • Loading branch information
xelaint committed Jun 14, 2024
1 parent 198d326 commit 4bc8ec8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 104 deletions.
26 changes: 0 additions & 26 deletions libs/design/callout/src/callout/callout.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,6 @@
}
}

// centered will be deprecated in v1.0.0
&--centered {
#{$root}__title {
margin: 0 auto;
text-align: center;
}

#{$root}__subtitle {
margin: 10px auto 0;
text-align: center;

@include layout.breakpoint(mobile) {
margin: 25px auto 0;
}
}
}

// compact will be deprecated in v1.0.0
&--compact {
padding: 25px;

@include layout.breakpoint(mobile) {
padding: 25px 50px;
}
}

&.daff-compact {
padding: 48px 24px;

Expand Down
40 changes: 2 additions & 38 deletions libs/design/callout/src/callout/callout.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@ import {
DaffTextAlignment,
} from '@daffodil/design';

import {
DaffCalloutComponent,
DaffCalloutLayout,
DaffCalloutSize,
} from './callout.component';
import { DaffCalloutComponent } from './callout.component';

@Component ({
template: `
<daff-callout [color]="color" [layout]="layout" [size]="size" [textAlignment]="textAlignment" [compact]="compact"></daff-callout>
<daff-callout [color]="color" [textAlignment]="textAlignment" [compact]="compact"></daff-callout>
`,
})

class WrapperComponent {
color: DaffPalette;
layout: DaffCalloutLayout;
size: DaffCalloutSize;
textAlignment: DaffTextAlignment;
compact = false;
}
Expand Down Expand Up @@ -81,36 +75,6 @@ describe('@daffodil/design/callout | DaffCalloutComponent', () => {
});
});

describe('setting the layout', () => {
describe('when layout="centered"', () => {
it('should add a class of "daff-callout--centered" to the host element', () => {
wrapper.layout = 'centered';
fixture.detectChanges();
expect(de.nativeElement.classList.contains('daff-callout--centered')).toBeTruthy();
});
});

it('should not set a default layout', () => {
expect(component.layout).toBeFalsy();
expect(de.nativeElement.classList.contains('daff-callout--centered')).toBeFalsy();
});
});

describe('setting the size', () => {
describe('when size="compact"', () => {
it('should add a class of "daff-callout--compact" to the host element', () => {
wrapper.size = 'compact';
fixture.detectChanges();
expect(de.nativeElement.classList.contains('daff-callout--compact')).toBeTruthy();
});
});

it('should not set a default size', () => {
expect(component.size).toBeFalsy();
expect(de.nativeElement.classList.contains('daff-callout--compact')).toBeFalsy();
});
});

it('should take textAlignment as an input', () => {
wrapper.textAlignment = 'left';
fixture.detectChanges();
Expand Down
40 changes: 0 additions & 40 deletions libs/design/callout/src/callout/callout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,6 @@ import {
daffTextAlignmentMixin,
} from '@daffodil/design';

/**
* @deprecated See {@link DaffTextAlignable}
*/
export type DaffCalloutLayout = 'centered' | undefined;
export enum DaffCalloutLayoutEnum {
Centered = 'centered'
}

/**
* @deprecated See {@link DaffCompactable}
*/
export type DaffCalloutSize = 'compact' | undefined;
export enum DaffCalloutSizeEnum {
Compact = 'compact'
}

/**
* An _elementRef and an instance of renderer2 are needed for the Colorable mixin
*/
Expand All @@ -58,16 +42,6 @@ const _daffCalloutBase = daffArticleEncapsulatedMixin(daffManageContainerLayoutM
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DaffCalloutComponent extends _daffCalloutBase implements DaffColorable, DaffTextAlignable, DaffCompactable {
/**
* @deprecated See {@link DaffTextAlignable}
*/
@Input() layout: DaffCalloutLayout;

/**
* @deprecated See {@link DaffCompactable}
*/
@Input() size: DaffCalloutSize;

constructor(private elementRef: ElementRef, private renderer: Renderer2) {
super(elementRef, renderer);
}
Expand All @@ -76,18 +50,4 @@ export class DaffCalloutComponent extends _daffCalloutBase implements DaffColora
* @docs-private
*/
@HostBinding('class.daff-callout') class = true;

/**
* @deprecated See {@link DaffTextAlignable}
*/
@HostBinding('class.daff-callout--centered') get centered() {
return this.layout === DaffCalloutLayoutEnum.Centered;
}

/**
* @deprecated See {@link DaffCompactable}
*/
@HostBinding('class.daff-callout--compact') get compactClass() {
return this.size === DaffCalloutSizeEnum.Compact;
}
}

0 comments on commit 4bc8ec8

Please sign in to comment.