Skip to content

Commit

Permalink
Offline badge component
Browse files Browse the repository at this point in the history
  • Loading branch information
filrak committed Dec 20, 2017
1 parent beadfb9 commit e80c10a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/components/core/OfflineBadge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div class="offline-badge absolute bg-black c-white">
You are offline
</div>
</template>

<script>
export default {
name: 'offline-badge',
data () {
return {
isOnline: navigator.onLine
}
},
created () {
window.addEventListener('online', (e) => {
this.isOnline = true
})
window.addEventListener('offline', (e) => {
this.isOnline = false
})
}
}
</script>

<style scoped>
.offline-badge {
width: 100%;
bottom: 0;
left: 0;
}
</style>
2 changes: 2 additions & 0 deletions src/themes/default/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Notification from './components/core/Notification.vue'
import SignUp from './components/core/blocks/Auth/SignUp.vue'
import NewsletterPopup from './components/core/NewsletterPopup.vue'
import CookieNotification from './components/core/CookieNotification.vue'
// import OfflineBadge from './components/core/OfflineBadge.vue'
export default {
computed: {
Expand All @@ -60,6 +61,7 @@ export default {
SignUp,
NewsletterPopup,
CookieNotification
// OfflineBadge
}
}
</script>
Expand Down
7 changes: 7 additions & 0 deletions src/themes/default/components/core/OfflineBadge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
import { coreComponent } from 'lib/themes'
export default {
mixins: [coreComponent('core/OfflineBadge')]
}
</script>

0 comments on commit e80c10a

Please sign in to comment.