Skip to content

Commit 9cbd0e3

Browse files
committed
fix(card-img): missing cCardImg input alias, add start-end orientation for horizontal img
1 parent e4b944e commit 9cbd0e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

projects/coreui-angular/src/lib/card/card-img.directive.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, Directive, input, InputSignal } from '@angular/core';
1+
import { computed, Directive, input } from '@angular/core';
22

33
@Directive({
44
selector: '[cCardImg]',
@@ -10,13 +10,16 @@ export class CardImgDirective {
1010
* Optionally orientate the image to the top, bottom, or make it overlaid across the card.
1111
* @type {'top | 'bottom'}
1212
*/
13-
readonly orientation: InputSignal<'top' | 'bottom' | undefined> = input<'top' | 'bottom'>();
13+
readonly orientation = input<'top' | 'bottom' | 'start' | 'end' | undefined>(undefined, { alias: 'cCardImg' });
1414

1515
readonly hostClasses = computed(() => {
1616
const orientation = this.orientation();
1717
const suffix = !!orientation ? `-${orientation}` : '';
18+
const horizontal = ['start', 'end'].includes(orientation ?? '-') ? orientation : undefined;
1819
return {
19-
[`card-img${suffix}`]: true
20+
[`card-img${suffix}`]: !horizontal,
21+
'img-fluid': !!horizontal,
22+
[`rounded-${horizontal}`]: !!horizontal
2023
} as Record<string, boolean>;
2124
});
2225
}

0 commit comments

Comments
 (0)