2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-01-30 20:53:16 +01:00
|
|
|
<div class="mkw-notifications" :style="`flex-basis: calc(${basis}% - var(--margin)); height: ${previewHeight}px;`">
|
|
|
|
<mk-container :show-header="!props.compact" class="container">
|
2020-01-29 20:37:25 +01:00
|
|
|
<template #header><fa :icon="faBell"/>{{ $t('notifications') }}</template>
|
|
|
|
|
2020-01-30 20:53:16 +01:00
|
|
|
<div class="tl">
|
2020-01-29 20:37:25 +01:00
|
|
|
<x-notifications/>
|
|
|
|
</div>
|
|
|
|
</mk-container>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { faBell } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkContainer from '../components/ui/container.vue';
|
|
|
|
import XNotifications from '../components/notifications.vue';
|
|
|
|
import define from './define';
|
|
|
|
import i18n from '../i18n';
|
|
|
|
|
2020-01-30 20:53:16 +01:00
|
|
|
const basisSteps = [25, 50, 75, 100]
|
|
|
|
const previewHeights = [200, 300, 400, 500]
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
export default define({
|
|
|
|
name: 'notifications',
|
|
|
|
props: () => ({
|
2020-01-30 20:53:16 +01:00
|
|
|
compact: false,
|
|
|
|
basisStep: 0
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
}).extend({
|
|
|
|
i18n,
|
|
|
|
|
|
|
|
components: {
|
|
|
|
MkContainer,
|
|
|
|
XNotifications,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
faBell
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-01-30 20:53:16 +01:00
|
|
|
computed: {
|
|
|
|
basis(): number {
|
|
|
|
return basisSteps[this.props.basisStep] || 25
|
|
|
|
},
|
|
|
|
|
|
|
|
previewHeight(): number {
|
|
|
|
return previewHeights[this.props.basisStep] || 200
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
methods: {
|
|
|
|
func() {
|
2020-01-30 20:53:16 +01:00
|
|
|
if (this.props.basisStep === basisSteps.length - 1) {
|
|
|
|
this.props.basisStep = 0
|
|
|
|
this.props.compact = !this.props.compact;
|
|
|
|
} else {
|
|
|
|
this.props.basisStep += 1
|
|
|
|
}
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
this.save();
|
2020-01-30 20:53:16 +01:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2020-01-30 20:53:16 +01:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.mkw-notifications {
|
|
|
|
flex-grow: 1;
|
|
|
|
flex-shrink: 0;
|
|
|
|
min-height: 0; // https://www.gwtcenter.com/min-height-required-on-firefox-flexbox
|
|
|
|
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> div {
|
|
|
|
overflow: auto;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.tl {
|
|
|
|
background: var(--bg);
|
2020-02-18 22:17:41 +01:00
|
|
|
padding: 8px;
|
2020-01-30 20:53:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|