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