Sharkey/packages/frontend/src/components/global/MkAvatar.stories.impl.ts

66 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-03-23 16:44:41 +09:00
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { StoryObj } from '@storybook/vue3';
import { userDetailed } from '../../../.storybook/fakes';
2023-03-23 16:44:41 +09:00
import MkAvatar from './MkAvatar.vue';
const common = {
2023-03-23 16:44:41 +09:00
render(args) {
return {
components: {
MkAvatar,
},
setup() {
return {
args,
};
},
computed: {
props() {
return {
2023-04-01 16:35:05 +09:00
...this.args,
2023-03-23 16:44:41 +09:00
};
},
},
template: '<MkAvatar v-bind="props" />',
};
},
args: {
user: userDetailed,
2023-03-23 16:44:41 +09:00
},
decorators: [
(Story, context) => ({
// eslint-disable-next-line quotes
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,
2023-03-23 16:44:41 +09:00
args: {
...common.args,
2023-03-23 16:44:41 +09:00
size: 120,
indicator: true,
},
2023-04-01 16:26:08 +09:00
} satisfies StoryObj<typeof MkAvatar>;
2023-03-23 16:44:41 +09:00
export const ProfilePageCat = {
...ProfilePage,
args: {
...ProfilePage.args,
user: {
...userDetailed,
2023-03-23 16:44:41 +09:00
isCat: true,
},
},
2023-04-02 14:59:19 +09:00
parameters: {
chromatic: {
/* Your story couldnt 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,
},
},
2023-04-01 16:26:08 +09:00
} satisfies StoryObj<typeof MkAvatar>;