fixed a lot of bugs with emoji picker, improved relevant components

This commit is contained in:
Henry Jameson 2019-08-12 20:01:38 +03:00
parent 579b5c9e77
commit 5851f97eb0
12 changed files with 300 additions and 150 deletions

View file

@ -4,7 +4,26 @@ import './tab_switcher.scss'
export default Vue.component('tab-switcher', {
name: 'TabSwitcher',
props: ['renderOnlyFocused', 'onSwitch', 'customActive'],
props: {
renderOnlyFocused: {
required: false,
type: Boolean,
default: false
},
onSwitch: {
required: false,
type: Function
},
customActive: {
required: false,
type: String
},
scrollableTabs: {
required: false,
type: Boolean,
default: false
}
},
data () {
return {
active: this.$slots.default.findIndex(_ => _.tag)
@ -18,7 +37,8 @@ export default Vue.component('tab-switcher', {
},
methods: {
activateTab (index, dataset) {
return () => {
return (e) => {
e.preventDefault()
if (typeof this.onSwitch === 'function') {
this.onSwitch.call(null, index, this.$slots.default[index].elm.dataset)
}
@ -85,7 +105,7 @@ export default Vue.component('tab-switcher', {
<div class="tabs">
{tabs}
</div>
<div class="contents">
<div class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')}>
{contents}
</div>
</div>

View file

@ -1,10 +1,21 @@
@import '../../_variables.scss';
.tab-switcher {
display: flex;
flex-direction: column;
.contents {
flex: 1 0 auto;
min-height: 0px;
.hidden {
display: none;
}
&.scrollable-tabs {
flex-basis: 0;
overflow-y: auto;
}
}
.tabs {
display: flex;