@ansiversa/components 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/AvEmptyState.astro +43 -10
package/package.json
CHANGED
package/src/AvEmptyState.astro
CHANGED
|
@@ -3,23 +3,56 @@ import AvButton from "./AvButton.astro";
|
|
|
3
3
|
import AvCard from "./AvCard.astro";
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
|
-
|
|
6
|
+
// preferred Ansiversa naming
|
|
7
|
+
headline?: string;
|
|
8
|
+
|
|
9
|
+
// current naming (keep for backward compatibility)
|
|
10
|
+
title?: string;
|
|
11
|
+
|
|
7
12
|
description?: string;
|
|
13
|
+
|
|
14
|
+
// CTA
|
|
8
15
|
ctaLabel?: string;
|
|
9
|
-
ctaHref?: string;
|
|
16
|
+
ctaHref?: string; // if provided => link CTA
|
|
17
|
+
ctaDisabled?: boolean; // if button CTA
|
|
18
|
+
className?: string;
|
|
10
19
|
}
|
|
11
20
|
|
|
12
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
headline,
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
ctaLabel,
|
|
26
|
+
ctaHref,
|
|
27
|
+
ctaDisabled = false,
|
|
28
|
+
className = "",
|
|
29
|
+
...attrs
|
|
30
|
+
} = Astro.props as Props & Record<string, any>;
|
|
31
|
+
|
|
32
|
+
const resolvedTitle = headline ?? title ?? "Empty";
|
|
13
33
|
---
|
|
14
34
|
|
|
15
|
-
<AvCard className=
|
|
35
|
+
<AvCard className={`av-empty-state ${className}`.trim()} {...attrs}>
|
|
16
36
|
<div class="av-empty-state__body">
|
|
17
|
-
<h3 class="av-empty-state__title">{
|
|
37
|
+
<h3 class="av-empty-state__title">{resolvedTitle}</h3>
|
|
38
|
+
|
|
18
39
|
{description && <p class="av-empty-state__description">{description}</p>}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
40
|
+
|
|
41
|
+
{ctaLabel ? (
|
|
42
|
+
ctaHref ? (
|
|
43
|
+
<AvButton href={ctaHref} variant="primary">
|
|
44
|
+
{ctaLabel}
|
|
45
|
+
</AvButton>
|
|
46
|
+
) : (
|
|
47
|
+
<AvButton
|
|
48
|
+
type="button"
|
|
49
|
+
variant="primary"
|
|
50
|
+
disabled={ctaDisabled}
|
|
51
|
+
onclick="this.dispatchEvent(new CustomEvent('cta', { bubbles: true }))"
|
|
52
|
+
>
|
|
53
|
+
{ctaLabel}
|
|
54
|
+
</AvButton>
|
|
55
|
+
)
|
|
56
|
+
) : null}
|
|
24
57
|
</div>
|
|
25
58
|
</AvCard>
|