generated from daviddarnes/component-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
75 lines (67 loc) · 1.98 KB
/
demo.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Demo of link-peek Web Component" />
<title>link-peek Web Component Demo</title>
<style>
:root {
font-family: system-ui;
}
link-peek:defined figure {
position: relative;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, max-content));
gap: 1rem;
max-inline-size: max-content;
border: 1px solid #ddd;
padding: 1rem;
margin: 0;
}
link-peek:defined a:not([data-key]) {
display: none;
}
link-peek img[data-key="data.image.url"] {
max-inline-size: 100%;
block-size: auto;
}
link-peek img[data-key="data.logo.url"] {
inline-size: 1rem;
block-size: 1rem;
vertical-align: middle;
}
link-peek a[data-key]::after {
content: "";
position: absolute;
inset: 0;
}
</style>
<script type="module" src="link-peek.js"></script>
</head>
<body>
<h2>General usage example</h2>
<template id="link-peek-template">
<figure>
<figcaption>
<a data-key="data.title, link"></a>
<p data-key="data.description"></p>
<img data-key="data.logo.url" />
<small data-key="data.publisher"></small>
</figcaption>
<img data-key="data.image.url" />
</figure>
</template>
<link-peek api="https://api.microlink.io/?url=${link}">
<a href="https://darn.es">David Darnes</a>
</link-peek>
<br>
<link-peek api="https://api.microlink.io/?url=${link}">
<a href="https://nordhealth.design">Nord Design System</a>
</link-peek>
<br>
<link-peek api="https://api.microlink.io/?url=${link}">
<a href="https://github.com">GitHub</a>
</link-peek>
</body>
</html>