-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathempty-state.ts
29 lines (23 loc) · 972 Bytes
/
empty-state.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { htmlSafe } from '@ember/template';
import { assert } from '@ember/debug';
import Component from '@glimmer/component';
interface OSSEmptyStateComponentSignature {
badgeIcon?: string;
title: ReturnType<typeof htmlSafe>;
subtitle: ReturnType<typeof htmlSafe>;
size?: 'sm' | 'md';
}
const ALLOWED_SIZES: string[] = ['sm', 'md'];
export default class OSSEmptyStateComponent extends Component<OSSEmptyStateComponentSignature> {
constructor(owner: unknown, args: OSSEmptyStateComponentSignature) {
super(owner, args);
assert('[component][OSS::EmptyState] The title parameter is mandatory', typeof args.title === 'string');
assert('[component][OSS::EmptyState] The subtitle parameter is mandatory', typeof args.subtitle === 'string');
}
get titleSize(): string {
return this.size === 'sm' ? 'md' : 'lg';
}
get size(): string {
return this.args.size && ALLOWED_SIZES.includes(this.args.size) ? this.args.size : 'md';
}
}