2023-08-13 13:12:29 +02:00
|
|
|
/*
|
2024-02-13 16:59:27 +01:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-08-13 13:12:29 +02:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
2024-05-01 09:39:16 +02:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2023-08-13 13:12:29 +02:00
|
|
|
import { StoryObj } from '@storybook/vue3';
|
2024-05-01 09:39:16 +02:00
|
|
|
import { HttpResponse, http } from 'msw';
|
|
|
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
2023-08-13 13:12:29 +02:00
|
|
|
import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
|
|
|
|
export const Default = {
|
|
|
|
render(args) {
|
|
|
|
return {
|
|
|
|
components: {
|
|
|
|
MkAnnouncementDialog,
|
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
return {
|
|
|
|
args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
props() {
|
|
|
|
return {
|
|
|
|
...this.args,
|
|
|
|
};
|
|
|
|
},
|
2024-05-01 09:39:16 +02:00
|
|
|
events() {
|
|
|
|
return {
|
|
|
|
closed: action('closed'),
|
|
|
|
};
|
|
|
|
},
|
2023-08-13 13:12:29 +02:00
|
|
|
},
|
2024-05-01 09:39:16 +02:00
|
|
|
template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
|
2023-08-13 13:12:29 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
announcement: {
|
|
|
|
id: '1',
|
|
|
|
title: 'Title',
|
|
|
|
text: 'Text',
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: null,
|
|
|
|
icon: 'info',
|
|
|
|
imageUrl: null,
|
|
|
|
display: 'dialog',
|
|
|
|
needConfirmationToRead: false,
|
2024-05-01 09:39:16 +02:00
|
|
|
silence: false,
|
2023-08-13 13:12:29 +02:00
|
|
|
forYou: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
layout: 'centered',
|
2024-05-01 09:39:16 +02:00
|
|
|
msw: {
|
|
|
|
handlers: [
|
|
|
|
...commonHandlers,
|
|
|
|
http.post('/api/i/read-announcement', async ({ request }) => {
|
|
|
|
action('POST /api/i/read-announcement')(await request.json());
|
|
|
|
return HttpResponse.json();
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
2023-08-13 13:12:29 +02:00
|
|
|
},
|
|
|
|
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|