-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from mugi-uno/add_expand_hidden_code
Add expand hidden code
- Loading branch information
Showing
6 changed files
with
145 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,62 @@ | ||
<template lang="pug"> | ||
.event-group | ||
event-item(v-for='e in events' :key='e.key' :event='e') | ||
event-group-control( | ||
:size='events.length' | ||
:open='eventGroup.open' | ||
@toggle='toggle' | ||
) | ||
.event-items | ||
event-item( | ||
v-for='e in showEvents' | ||
:key='e.key' | ||
:event='e' | ||
) | ||
</template> | ||
|
||
<script> | ||
import EventGroupControl from './EventGroupControl'; | ||
import EventItem from './EventItem'; | ||
export default { | ||
name: 'EventGroup', | ||
props: ['eventGroup'], | ||
components: { EventItem }, | ||
components: { EventGroupControl, EventItem }, | ||
computed: { | ||
events() { | ||
return this.eventGroup.events.filter(e => e.show); | ||
return this.eventGroup.events; | ||
}, | ||
showEvents() { | ||
if (this.eventGroup.open) { | ||
return this.events; | ||
} | ||
return this.events.filter(e => e.show); | ||
}, | ||
}, | ||
methods: { | ||
toggle() { | ||
this.$store.dispatch('toggleEventGroup', this.eventGroup.key); | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.event-group { | ||
display: flex; | ||
align-items: center; | ||
box-shadow: -1px 1px 1px #ddd; | ||
border-radius: 2px; | ||
margin: 5px; | ||
padding: 5px; | ||
overflow-x: scroll; | ||
} | ||
.event-items { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template lang="pug"> | ||
.event-group-control | ||
template(v-if='expandable') | ||
v-btn( | ||
flat icon :color='toggleButtonColor' | ||
@click.native='toggle' | ||
) | ||
v-icon {{toggleIcon}} | ||
template(v-else) | ||
v-icon.default-icon(color='grey lighten-2') check | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'EventGroupControl', | ||
props: ['size', 'open'], | ||
computed: { | ||
expandable() { | ||
return this.size && this.size > 1; | ||
}, | ||
toggleButtonColor() { | ||
return this.open ? 'blue' : 'grey'; | ||
}, | ||
toggleIcon() { | ||
return this.open ? 'arrow_drop_up' : 'arrow_drop_down'; | ||
}, | ||
}, | ||
methods: { | ||
toggle() { | ||
this.$emit('toggle'); | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.event-group-control button { | ||
margin: 0px 5px 0px 0px; | ||
height: 20px; | ||
width: 20px; | ||
} | ||
.default-icon { | ||
margin: 0px 5px 0px 0px; | ||
height: 20px; | ||
width: 20px; | ||
font-size: 14px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters