Skip to content

Commit

Permalink
feat: save that banner was closed
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Mar 19, 2023
1 parent 57dca7f commit b48dc53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 111 deletions.
13 changes: 10 additions & 3 deletions components/layout/AnnouncementBanner.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
v-if="show"
v-if="isShown"
class="relative isolate flex items-center gap-x-6 overflow-hidden bg-black py-2.5 px-6 sm:px-3.5 sm:before:flex-1"
>
<!-- Background -->
Expand Down Expand Up @@ -55,7 +55,7 @@
<button
class="-m-3 p-3 focus-visible:outline-offset-[-4px]"
type="button"
@click="show = false"
@click="isShown = false"
>
<span class="sr-only">Dismiss</span>
<XIcon
Expand All @@ -70,14 +70,21 @@
<script>
import { XIcon } from 'vue-feather-icons'
const localStorageKey = 'hp-banner'
export default {
components: {
XIcon
},
data() {
return {
show: true
isShown: localStorage.getItem(localStorageKey) !== 'false'
}
},
watch: {
isShown(value) {
localStorage.setItem(localStorageKey, value)
}
}
}
Expand Down
107 changes: 0 additions & 107 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@nuxtjs/sentry": "^7.1.4",
"@nuxtjs/sitemap": "^2.4.0",
"@nuxtjs/toast": "^3.3.1",
"@vueuse/core": "^5.3.0",
"lodash-es": "^4.17.21",
"nuxt": "^2.16.3",
"portal-vue": "^2.1.7",
Expand Down

0 comments on commit b48dc53

Please sign in to comment.