forked from mirror/misskey
Make notifications widget flexible (#5791)
* Make notifications widget flexible * fix
This commit is contained in:
parent
1f8334dcb7
commit
db24dddeff
@ -929,7 +929,7 @@ export default Vue.extend({
|
|||||||
> div {
|
> div {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: calc(#{$header-height} + var(--margin));
|
top: calc(#{$header-height} + var(--margin));
|
||||||
height: calc(100vh - #{$header-height} - var(--margin) * 2);
|
height: calc(100vh - #{$header-height} - var(--margin));
|
||||||
|
|
||||||
&.edit {
|
&.edit {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mkw-notifications">
|
<div class="mkw-notifications" :style="`flex-basis: calc(${basis}% - var(--margin)); height: ${previewHeight}px;`">
|
||||||
<mk-container :show-header="!props.compact">
|
<mk-container :show-header="!props.compact" class="container">
|
||||||
<template #header><fa :icon="faBell"/>{{ $t('notifications') }}</template>
|
<template #header><fa :icon="faBell"/>{{ $t('notifications') }}</template>
|
||||||
|
|
||||||
<div style="height: 300px; overflow: auto; background: var(--bg);">
|
<div class="tl">
|
||||||
<x-notifications/>
|
<x-notifications/>
|
||||||
</div>
|
</div>
|
||||||
</mk-container>
|
</mk-container>
|
||||||
@ -17,10 +17,14 @@ import XNotifications from '../components/notifications.vue';
|
|||||||
import define from './define';
|
import define from './define';
|
||||||
import i18n from '../i18n';
|
import i18n from '../i18n';
|
||||||
|
|
||||||
|
const basisSteps = [25, 50, 75, 100]
|
||||||
|
const previewHeights = [200, 300, 400, 500]
|
||||||
|
|
||||||
export default define({
|
export default define({
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
props: () => ({
|
props: () => ({
|
||||||
compact: false
|
compact: false,
|
||||||
|
basisStep: 0
|
||||||
})
|
})
|
||||||
}).extend({
|
}).extend({
|
||||||
i18n,
|
i18n,
|
||||||
@ -36,11 +40,51 @@ export default define({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
basis(): number {
|
||||||
|
return basisSteps[this.props.basisStep] || 25
|
||||||
|
},
|
||||||
|
|
||||||
|
previewHeight(): number {
|
||||||
|
return previewHeights[this.props.basisStep] || 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
func() {
|
func() {
|
||||||
|
if (this.props.basisStep === basisSteps.length - 1) {
|
||||||
|
this.props.basisStep = 0
|
||||||
this.props.compact = !this.props.compact;
|
this.props.compact = !this.props.compact;
|
||||||
|
} else {
|
||||||
|
this.props.basisStep += 1
|
||||||
|
}
|
||||||
|
|
||||||
this.save();
|
this.save();
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<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 {
|
||||||
|
height: 100%;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mkw-timeline" :style="`flex-basis: ${basis}%; height: ${previewHeight}px;`">
|
<div class="mkw-timeline" :style="`flex-basis: calc(${basis}% - var(--margin)); height: ${previewHeight}px;`">
|
||||||
<mk-container :show-header="!props.compact" class="container">
|
<mk-container :show-header="!props.compact" class="container">
|
||||||
<template #header>
|
<template #header>
|
||||||
<button @click="choose" class="_button">
|
<button @click="choose" class="_button">
|
||||||
@ -61,7 +61,7 @@ export default define({
|
|||||||
},
|
},
|
||||||
|
|
||||||
previewHeight(): number {
|
previewHeight(): number {
|
||||||
return previewHeights[this.props.basisStep] || 300
|
return previewHeights[this.props.basisStep] || 200
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user