Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

project-style.directive.ts

22 lines461 Bytes

1import { Directive, computed, input } from '@angular/core'
2​
3@Directive({
4 selector: '[projectStyle]',
5 host: {
6 '[style]': 'style()',
7 },
8})
9export class ProjectStyleDirective {
10 readonly projectStyle = input.required<number>()
11​
12 readonly style = computed(
13 () =>
14 `
15 border: 1px solid gray;
16 border-radius: 5px;
17 padding: 8px;
18 font-size: 14px;
19 background: hsla(${this.projectStyle() * 30}, 60%, 80%, 1);
20 `,
21 )