Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
feat(demo): Add snackbar demo (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Apr 17, 2018
1 parent 828edff commit cc4a4b9
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
4 changes: 4 additions & 0 deletions demo/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export default new VueRouter({
path: '/select',
component: () => import('views/SelectView')
},
{
path: '/snackbar',
component: () => import('views/SnackbarView')
},
{
path: '/textfield',
component: () => import('views/TextfieldView')
Expand Down
6 changes: 6 additions & 0 deletions demo/store/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ const state = {
icon: 'code',
reference: 'https://github.com/matsp/material-components-vue/tree/master/components/select'
},
snackbar: {
text: 'Snackbar',
route: '/snackbar',
icon: 'code',
reference: 'https://github.com/matsp/material-components-vue/tree/master/components/snackbar'
},
textfield: {
text: 'Textfield',
route: '/textfield',
Expand Down
64 changes: 64 additions & 0 deletions demo/views/SnackbarView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<m-layout-grid-inner>
<m-layout-grid-cell :span="12">
<m-typo-title>Normal</m-typo-title>
<m-layout-grid-inner>
<m-layout-grid-cell :span="3">
<m-button
raised
interactive
@click="isSnackbarOpen=true">open</m-button>
<m-snackbar
:options="options"
v-model="isSnackbarOpen"/>
</m-layout-grid-cell>
</m-layout-grid-inner>
</m-layout-grid-cell>
<m-layout-grid-cell :span="12">
<m-typo-title>AlignStart</m-typo-title>
<m-layout-grid-inner>
<m-layout-grid-cell :span="2">
<m-button
raised
interactive
@click="isSnackbar2Open=true">open</m-button>
<m-snackbar
alignStart
:options="options"
v-model="isSnackbar2Open"/>
</m-layout-grid-cell>
</m-layout-grid-inner>
</m-layout-grid-cell>
</m-layout-grid-inner>
</template>

<script>
import Vue from 'vue'
import Button from '../../dist/button'
import Snackbar from '../../dist/snackbar'
Vue.use(Button)
Vue.use(Snackbar)
export default {
data () {
return {
isSnackbarOpen: false,
isSnackbar2Open: false,
options: {
message: 'I am a snackbar!',
timeout: 3000,
actionHandler: () => console.log('snackbar action'),
actionText: 'ok',
multiline: false,
actionOnBottom: false
}
}
}
}
</script>

<style lang="scss">
@import "../../dist/button/styles";
@import "../../dist/snackbar/styles";
</style>

0 comments on commit cc4a4b9

Please sign in to comment.