forked from microsoft/fast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskeleton.template.ts
30 lines (29 loc) · 952 Bytes
/
skeleton.template.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
30
import { html, when } from "@microsoft/fast-element";
import type { ViewTemplate } from "@microsoft/fast-element";
import type { FoundationElementTemplate } from "../foundation-element/foundation-element.js";
import type { Skeleton } from "./skeleton.js";
/**
* The template for the fast-skeleton component
* @public
*/
export const skeletonTemplate: FoundationElementTemplate<ViewTemplate<Skeleton>> = (
context,
definition
) => html`
<template
class="${x => (x.shape === "circle" ? "circle" : "rect")}"
pattern="${x => x.pattern}"
?shimmer="${x => x.shimmer}"
>
${when(
x => x.shimmer === true,
html`
<span class="shimmer"></span>
`
)}
<object type="image/svg+xml" data="${x => x.pattern}" role="presentation">
<img class="pattern" src="${x => x.pattern}" />
</object>
<slot></slot>
</template>
`;