2023-08-13 11:12:29 +00:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-08-13 11:12:29 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
2024-05-01 07:39:16 +00:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2023-08-13 11:12:29 +00:00
|
|
|
import { StoryObj } from '@storybook/vue3';
|
2024-05-01 07:39:16 +00:00
|
|
|
import { HttpResponse, http } from 'msw';
|
|
|
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
2023-08-13 11:12:29 +00: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 07:39:16 +00:00
|
|
|
events() {
|
|
|
|
return {
|
|
|
|
closed: action('closed'),
|
|
|
|
};
|
|
|
|
},
|
2023-08-13 11:12:29 +00:00
|
|
|
},
|
2024-05-01 07:39:16 +00:00
|
|
|
template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
|
2023-08-13 11:12:29 +00: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 07:39:16 +00:00
|
|
|
silence: false,
|
2023-08-13 11:12:29 +00:00
|
|
|
forYou: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
layout: 'centered',
|
2024-05-01 07:39:16 +00: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 11:12:29 +00:00
|
|
|
},
|
|
|
|
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|