Skip to content

Commit 4f9fb43

Browse files
authored
Merge pull request #10945 from marmelab/shadcn-banner-master
[website] Add banner to announce Shadcn Admin Kit - `master`
2 parents c46aabf + 8519f31 commit 4f9fb43

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

docs/_includes/banner.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<div
2+
id="banner"
3+
style="
4+
background-color: #db2777;
5+
padding: 6px 20px;
6+
text-align: center;
7+
justify-content: center;
8+
display: none;
9+
"
10+
>
11+
<!-- <a
12+
href="https://react-admin.lemonsqueezy.com/"
13+
style="color: #fff; display: flex; align-items: center; gap: 0.5rem"
14+
>
15+
<span aria-hidden="true" id="randomEmoji"></span>
16+
<span style="text-align: center">
17+
<strong> - Save 30% on all yearly plans </strong>
18+
until December 20th with code
19+
<strong>XMAS</strong>
20+
<strong>&gt;</strong>
21+
</span>
22+
</a> -->
23+
<a
24+
href="https://marmelab.com/shadcn-admin-kit/"
25+
style="color: #fff; display: flex; align-items: center; gap: 0.5rem"
26+
>
27+
<span style="text-align: center">
28+
📣 React-admin for Shadcn UI is here! Check out
29+
<b>Shadcn Admin Kit</b>
30+
📣
31+
</span>
32+
</a>
33+
<span
34+
id="closeBanner"
35+
aria-label="Close"
36+
style="position: absolute; right: 10px; top: 6px"
37+
>
38+
<a href="javascript:hideBanner()" style="color: #fff">
39+
<span></span>
40+
</a>
41+
</span>
42+
</div>

docs/_includes/banner_script.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script>
2+
function hideBanner() {
3+
const banner = document.getElementById("banner");
4+
if (banner) {
5+
banner.style.display = "none";
6+
}
7+
window.localStorage.setItem("hideBannerDate", Date.now().toString());
8+
}
9+
const hideBannerDate = parseInt(
10+
window.localStorage.getItem("hideBannerDate") || "0",
11+
10
12+
);
13+
if (
14+
!hideBannerDate ||
15+
Date.now() - hideBannerDate > 14 * 24 * 60 * 60 * 1000
16+
) {
17+
const emojis = ["🎄", "🎅", "🎁", "🎉", "🦌", "🤶", "🌟", "🔔", "🧦"];
18+
const randomEmoji = document.getElementById("randomEmoji");
19+
if (randomEmoji) {
20+
randomEmoji.innerHTML = emojis[Math.floor(Math.random() * emojis.length)];
21+
}
22+
const banner = document.getElementById("banner");
23+
if (banner) {
24+
banner.style.display = "flex";
25+
}
26+
}
27+
</script>

docs/_layouts/default.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105

106106
<body>
107107
<header>
108+
{% include banner.html %}
108109
{% include nav.html %}
109110
<ul id="slide-out" class="sidenav sidenav-fixed">
110111
<li class="logo">
@@ -192,5 +193,7 @@
192193

193194
var AUTOHIDE = Boolean(0);
194195
</script>
196+
197+
{% include banner_script.html %}
195198
</body>
196199
</html>

docs/documentation.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797

9898
<body>
9999
<header>
100+
{% include banner.html %}
100101
{% include nav.html %}
101102
<ul id="slide-out" class="sidenav sidenav-fixed">
102103
<li class="logo">
@@ -361,5 +362,7 @@ <h2>Recipes</h2>
361362

362363
var AUTOHIDE = Boolean(0);
363364
</script>
365+
366+
{% include banner_script.html %}
364367
</body>
365368
</html>

0 commit comments

Comments
 (0)