summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/global/MkAvatar.stories.impl.ts
blob: 9d2de9f0be81698285652d09637d51dc27df9281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { StoryObj } from '@storybook/vue3';
import { userDetailed } from '../../../.storybook/fakes.js';
import MkAvatar from './MkAvatar.vue';
const common = {
	render(args) {
		return {
			components: {
				MkAvatar,
			},
			setup() {
				return {
					args,
				};
			},
			computed: {
				props() {
					return {
						...this.args,
					};
				},
			},
			template: '<MkAvatar v-bind="props" />',
		};
	},
	args: {
		user: userDetailed(),
	},
	decorators: [
		(Story, context) => ({
			// @ts-expect-error size is for test
			template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
		}),
	],
	parameters: {
		layout: 'centered',
	},
} satisfies StoryObj<typeof MkAvatar>;
export const ProfilePage = {
	...common,
	args: {
		...common.args,
		// @ts-expect-error size is for test
		size: 120,
		indicator: true,
	},
} satisfies StoryObj<typeof MkAvatar>;
export const ProfilePageCat = {
	...ProfilePage,
	args: {
		...ProfilePage.args,
		user: {
			...userDetailed(),
			isCat: true,
		},
	},
	parameters: {
		...ProfilePage.parameters,
		chromatic: {
			/* Your story couldn’t be captured because it exceeds our 25,000,000px limit. Its dimensions are 5,504,893x5,504,892px. Possible ways to resolve:
			 * * Separate pages into components
			 * * Minimize the number of very large elements in a story
			 */
			disableSnapshot: true,
		},
	},
} satisfies StoryObj<typeof MkAvatar>;