Skip to content

Commit 455f40e

Browse files
UI(skeleton): Add Skeleton directive
1 parent 78167bb commit 455f40e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { computed, Directive, input } from "@angular/core";
2+
import { tv } from "tailwind-variants";
3+
4+
const skeletonVariants = tv({
5+
slots: {
6+
skeleton: 'bg-accent animate-pulse rounded-md'
7+
}
8+
});
9+
10+
const { skeleton } = skeletonVariants();
11+
12+
@Directive({
13+
selector: '[uiSkeleton]',
14+
exportAs: 'uiSkeleton',
15+
host: {
16+
'[class]': 'computedClass()'
17+
}
18+
})
19+
export class UiSkeleton {
20+
inputClass = input<string>('', { alias: 'class' });
21+
computedClass = computed(() => skeleton({ class: this.inputClass() }));
22+
}

projects/ui/src/public-api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export * from './directives/breadcrumb';
2020
export * from './directives/form-field';
2121
export * from './directives/checkbox';
2222
export * from './directives/toggle';
23-
export * from './directives/toggle-group';
23+
export * from './directives/toggle-group';
24+
export * from './directives/skeleton';

0 commit comments

Comments
 (0)