Skip to content
This repository was archived by the owner on Apr 1, 2021. It is now read-only.

Commit 11cfc34

Browse files
committed
add vue-notification
1 parent 7126c6f commit 11cfc34

File tree

7 files changed

+80
-1
lines changed

7 files changed

+80
-1
lines changed

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"simple-line-icons": "^2.4.1",
5050
"vue": "^2.5.16",
5151
"vue-chartjs": "^3.3.2",
52+
"vue-notification": "^1.3.10",
5253
"vue-router": "^3.0.1",
5354
"vuejs-datepicker": "^1.5.2",
5455
"vuex": "^3.0.1"

resources/assets/js/coreui/containers/Full.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<AppHeader/>
44
<div class="app-body">
55
<Sidebar :nav-items="nav"/>
6+
<notifications
7+
class="custom-notifications"
8+
:style="{ 'margin-top': offset }" />
69
<main class="main">
710
<breadcrumb :list="list"/>
811
<div class="container-fluid">
@@ -30,7 +33,8 @@ export default {
3033
},
3134
data () {
3235
return {
33-
nav: nav.items,
36+
nav : nav.items,
37+
offset: true,
3438
}
3539
},
3640
computed: {
@@ -41,5 +45,19 @@ export default {
4145
return this.$route.matched
4246
},
4347
},
48+
methods: {
49+
setPosNotify () {
50+
const top = $(document).scrollTop()
51+
const offset = top < 55 ? 55 - top : 0
52+
53+
this.offset = `${offset}px`
54+
},
55+
},
56+
mounted () {
57+
$(window).on('scroll', this.setPosNotify)
58+
},
59+
beforeDestroy () {
60+
$(window).off('scroll', this.setPosNotify)
61+
},
4462
}
4563
</script>

resources/assets/js/coreui/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import Vue from 'vue'
44
import BootstrapVue from 'bootstrap-vue'
55
import Datepicker from 'vuejs-datepicker'
66
import { id } from 'vuejs-datepicker/dist/locale'
7+
import Notifications from 'vue-notification'
78
import App from './App'
89
import router from './router'
910
import store from './store'
1011

1112
Vue.use(BootstrapVue)
13+
Vue.use(Notifications)
1214

1315
Vue.component('b-datepicker', {
1416
extends: Datepicker,

resources/assets/js/coreui/views/notifications/Alerts.vue

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,32 @@
209209
</div>
210210
</b-card>
211211
</b-col>
212+
<b-col
213+
cols="12"
214+
md="6">
215+
<b-card
216+
header-tag="header"
217+
footer-tag="footer">
218+
<div slot="header">
219+
<i class="fa fa-align-justify"/> Alerts <small>with <b>Vue Notification</b></small>
220+
</div>
221+
<b-button
222+
variant="success"
223+
@click="showNotify('success')">
224+
Success
225+
</b-button>
226+
<b-button
227+
variant="warning"
228+
@click="showNotify('warning')">
229+
Warning
230+
</b-button>
231+
<b-button
232+
variant="danger"
233+
@click="showNotify('danger')">
234+
Danger
235+
</b-button>
236+
</b-card>
237+
</b-col>
212238
</b-row>
213239
</div>
214240
</div>
@@ -231,6 +257,13 @@ export default {
231257
showAlert () {
232258
this.dismissCountDown = this.dismissSecs
233259
},
260+
showNotify (type) {
261+
this.$notify({
262+
type,
263+
title: 'Important message',
264+
text : 'Hello user! This is a notification!',
265+
})
266+
},
234267
},
235268
}
236269
</script>

resources/assets/sass/coreui/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ $simple-line-font-path: '~simple-line-icons/fonts/';
3131

3232
// Custom styles
3333
@import 'custom';
34+
@import 'vendors/vue-notification/notification';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vue-notification {
2+
&.warning {
3+
background: #ffb648;
4+
border-left-color: #f48a06;
5+
}
6+
7+
&.danger {
8+
background: #E54D42;
9+
border-left-color: #B82E24;
10+
}
11+
}

0 commit comments

Comments
 (0)