Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions src/shared/ui/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { Meta, StoryObj } from '@storybook/react';

import { mockAvatar } from '@/shared/assets';

import { Avatar } from './Avatar';

type StoryArgs = {
image?: string;
size?: number;
borderRadius?: number;
withBorder?: boolean;
className?: string;
};

const meta: Meta<StoryArgs> = {
title: 'shared/Avatar',
component: Avatar,
tags: ['autodocs'],
parameters: {
layout: 'centered',
},
argTypes: {
image: {
control: 'text',
description: 'Avatar image url',
},
size: {
description: 'Avatar size (width & height)',
},
borderRadius: {
description: 'Border radius',
},
withBorder: {
description: 'Show border around avatar',
},
},
};

export default meta;

type Story = StoryObj<StoryArgs>;

const Template: Story = {
render: (args) => <Avatar {...args} />,
};

export const Default: Story = {
...Template,
args: {
size: 50,
borderRadius: 25,
withBorder: false,
},
};

export const WithoutImage: Story = {
...Template,
args: {
size: 50,
},
};

export const WithBorder: Story = {
...Template,
args: {
borderRadius: 25,
withBorder: true,
},
};

export const WithImage: Story = {
...Template,
args: {
image: mockAvatar,
size: 50,
},
};

export const WithBorderAndImage: Story = {
...Template,
args: {
image: mockAvatar,
withBorder: true,
},
};