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

67 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-03-21 16:25:17 +01:00
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable import/no-default-export */
2023-03-23 08:44:41 +01:00
import { Meta } from '@storybook/vue3';
2023-03-19 14:22:14 +01:00
const meta = {
title: 'components/global/MkAvatar',
component: MkAvatar,
} satisfies Meta<typeof MkAvatar>;
2023-03-23 08:44:41 +01:00
export default meta;
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable import/no-duplicates */
import { StoryObj } from '@storybook/vue3';
import { userDetailed } from '../../../.storybook/fakes';
2023-03-23 08:44:41 +01:00
import MkAvatar from './MkAvatar.vue';
2023-03-19 14:22:14 +01:00
export const Default = {
2023-03-23 08:44:41 +01:00
render(args) {
return {
components: {
MkAvatar,
},
2023-03-23 08:44:41 +01:00
setup() {
return {
args,
};
},
computed: {
props() {
return {
...args,
};
},
},
template: '<MkAvatar v-bind="props" />',
};
2023-03-19 14:22:14 +01:00
},
2023-03-23 08:44:41 +01:00
args: {
size: 48,
user: userDetailed,
2023-03-23 08:44:41 +01: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>;
2023-03-23 08:44:41 +01:00
export const ProfilePage = {
...Default,
args: {
...Default.args,
size: 120,
indicator: true,
},
};
export const ProfilePageCat = {
...ProfilePage,
args: {
...ProfilePage.args,
user: {
...userDetailed,
2023-03-23 08:44:41 +01:00
isCat: true,
},
},
};