Skip to content

Commit 03be90e

Browse files
committed
add github ribbon to docs page
1 parent 0e1207a commit 03be90e

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

docs/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
<meta name="keywords" content="viewability, viewable, tracking, ads, lazy, lazy-loading, svelte, svelte component, intersection observer, observer" />
1414

1515
<meta property="og:url" content="" />
16-
<meta property="og:title" content="svelte-viewable" />
16+
<meta property="og:title" content="@svelte-plugins/viewable" />
1717
<meta property="og:description" content="A simple rule-based approach to tracking element viewability." />
1818
<meta property="og:image" content="favicon.png" />
1919

2020
<meta name="twitter:card" content="summary" />
2121
<meta name="twitter:creator" content="@norcalkieran" />
22-
<meta name="twitter:title" content="svelte-viewable" />
22+
<meta name="twitter:title" content="@svelte-plugins/viewable" />
2323
<meta name="twitter:description" content="A simple rule-based approach to tracking element viewability." />
2424
<meta name="twitter:image" content="favicon.png" />
2525
</head>
2626
<body>
27+
<a href="https://github.com/svelte-plugins/viewable" class="github-ribbon"><img loading="lazy" width="149" height="149" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_darkblue_121621.png?resize=149%2C149" class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1"></a>
2728
<script type="module" src="/src/index.js"></script>
2829
</body>
2930
</html>

docs/public/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,10 @@ button:not(:disabled):active {
7272
button:focus {
7373
border-color: #666;
7474
}
75+
76+
.github-ribbon {
77+
position: fixed;
78+
right: 0;
79+
top: 0;
80+
z-index: 100;
81+
}

docs/src/App.svelte

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
import ContainerExample from './ContainerExample.svelte';
33
44
let enableObstructionDetection = false;
5+
let status = 'Hidden';
56
67
const handleClick = () => (enableObstructionDetection = !enableObstructionDetection);
7-
</script>
88
9-
<button id="obstructions" data-testid="toggle-obstructions" on:click={handleClick}>
10-
Toggle Obstructions
11-
</button>
9+
$: status = enableObstructionDetection ? 'Visible' : 'Hidden';
10+
</script>
1211

1312
{#if enableObstructionDetection}
1413
<div id="overlay"></div>
1514
{/if}
1615

1716
<div class="container flex flex-col px-4 m-8 mx-auto space-y-4 sm:px-6 lg:px-8">
1817
<div class="container">
19-
<p class="badge">Open dev console to see debug output.</p>
18+
<button id="obstructions" class="badge" data-testid="toggle-obstructions" class:on={enableObstructionDetection} on:click={handleClick}>
19+
Obstructions: {status}
20+
</button>
21+
<p class="badge"><b>Hint:</b> Open dev console to see debug output.</p>
2022
</div>
2123
<div class="flex justify-between">
2224
<div class="w-1/2 mr-4 h-64 block"></div>
@@ -123,7 +125,6 @@
123125
border-radius: 4px;
124126
display: inline-block;
125127
color: #111;
126-
display: inline-block;
127128
padding: 8px 16px;
128129
}
129130
@@ -140,10 +141,14 @@
140141
}
141142
142143
#obstructions {
143-
padding: 8px 16px;
144-
position: fixed;
145-
right: 4px;
146-
top: 4px;
144+
background: #eee;
145+
border: 0;
146+
margin-right: 8px;
147+
}
148+
149+
#obstructions.on {
150+
background-color: #4a90e2;
151+
color: #fff;
147152
}
148153
149154
#overlay {

0 commit comments

Comments
 (0)