generated from daviddarnes/component-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
73 lines (68 loc) · 1.83 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
<!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 share-button Web Component" />
<title>share-button Web Component Demo</title>
<script type="module" src="share-button.js"></script>
</head>
<body>
<h2>General example</h2>
<share-button>
<button>Share</button>
</share-button>
<hr />
<h2>Example using a fallback links</h2>
<share-button>
<button>Share</button>
<a
href="https://twitter.com/intent/tweet/?url=https://website.com&text=Example&via=DavidDarnes"
>
Post to Twitter
</a>
<a href="https://facebook.com/sharer/sharer.php?u=https://website.com">
Post to Facebook
</a>
<a
href="https://www.linkedin.com/shareArticle?url=https://website.com&title=Example&source=Title&mini=true"
>
Post to LinkedIn
</a>
<!-- Find more sharing links here https://codepen.io/daviddarnes/pen/GRJgoxy -->
</share-button>
<style>
share-button:not(:defined) button,
share-button:defined a {
display: none;
}
share-button:not(:defined) a + a {
margin-inline-start: 1ch;
}
</style>
<hr />
<h2>
Example using a fallback
<code>readonly</code>
input
</h2>
<share-button>
<button>Share</button>
<label>
Share this page
<input
type="url"
readonly
value="https://daviddarnes.github.io/share-button/demo.html"
onclick="this.select()"
/>
</label>
</share-button>
<style>
share-button:not(:defined) button,
share-button:defined label {
display: none;
}
</style>
</body>
</html>