@@ -10,19 +10,29 @@ export const SiteNoticeBanner = () => {
1010 x-data = "{
1111 bannerVisible: false,
1212 bannerVisibleAfter: 300,
13+ checkBannerStatus() {
14+ const isBannerHidden = localStorage.getItem('typst-jp-banner-hidden') === 'true';
15+ if (!isBannerHidden) {
16+ setTimeout(() => {
17+ this.bannerVisible = true;
18+ this.$el.classList.remove('-translate-y-full');
19+ }, this.bannerVisibleAfter);
20+ }
21+ },
22+ hideBanner() {
23+ this.bannerVisible = false;
24+ localStorage.setItem('typst-jp-banner-hidden', 'true');
25+ }
1326 }"
27+ x-init = "checkBannerStatus()"
1428 x-show = "bannerVisible"
1529 x-transition :enter = "transition ease-out duration-500"
1630 x-transition :enter-start = "-translate-y-full"
1731 x-transition :enter-end = "translate-y-0"
1832 x-transition :leave = "transition ease-in duration-300"
1933 x-transition :leave-start = "translate-y-0"
2034 x-transition :leave-end = "-translate-y-full"
21- x-init = "
22- setTimeout(()=>{ bannerVisible = true }, bannerVisibleAfter);
23- "
24- class = "fixed z-50 top-0 left-0 w-full h-auto py-2 duration-300 ease-out bg-white shadow-sm sm:py-4"
25- x-cloak
35+ class = "fixed z-50 top-0 left-0 w-full h-auto py-2 duration-300 ease-out bg-white shadow-sm sm:py-4 -translate-y-full"
2636 >
2737 < div class = "prose relative flex flex-col sm:flex-row items-start w-full px-3 sm:px-12 mx-auto max-w-7xl flex-wrap" >
2838 < div class = "flex flex-col sm:flex-row w-full text-xs leading-6 text-black duration-150 ease-out opacity-80 hover:opacity-100 gap-3" >
@@ -95,7 +105,7 @@ export const SiteNoticeBanner = () => {
95105 </ div >
96106 </ div >
97107 < button
98- x-on :click = "bannerVisible=false; "
108+ x-on :click = "hideBanner() "
99109 class = "absolute top-2 right-4 flex items-center flex-shrink-0 translate-x-1 ease-out duration-150 justify-center w-6 h-6 p-1.5 text-black rounded-full hover:bg-neutral-100"
100110 >
101111 < svg
0 commit comments