This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: 📝 add storybook story for sidebar-profile and docs
- Loading branch information
Showing
2 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
client/src/widgets/Sidebar/ui/sidebar-profile/sidebar-profile.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { SidebarProfile, SidebarProfileProps } from './sidebar-profile'; | ||
import { User } from 'entities/user'; | ||
|
||
const defaultUser: User = { | ||
_id: '123123312', | ||
email: '[email protected]', | ||
password: '$2a$05$7AnHdyBKd7kh78kkSt4OIOaBAidnedL3Sr6ZfFOKG5xcVatrPT4kq', | ||
isRegistered: true, | ||
fullName: 'John Doe', | ||
username: 'john.doe', | ||
image: '/images/user-images/user-red.png', | ||
}; | ||
|
||
const sidebarProfileProps: SidebarProfileProps = { | ||
active: false, | ||
user: defaultUser, | ||
}; | ||
|
||
type Story = StoryObj<typeof SidebarProfile>; | ||
const SidebarProfileTemplate: Story = { render: args => <SidebarProfile {...args} /> }; | ||
|
||
export const Playground = { ...SidebarProfileTemplate }; | ||
Playground.args = sidebarProfileProps; | ||
|
||
// Active User Profile | ||
export const ActiveUserProfile = { ...SidebarProfileTemplate }; | ||
ActiveUserProfile.args = { | ||
...sidebarProfileProps, | ||
active: true, | ||
}; | ||
|
||
// Inactive User Profile | ||
export const InactiveUserProfile = { ...SidebarProfileTemplate }; | ||
InactiveUserProfile.args = { | ||
...sidebarProfileProps, | ||
active: false, | ||
}; | ||
|
||
// Unregistered User Profile | ||
export const UnregisteredUserProfile = { ...SidebarProfileTemplate }; | ||
UnregisteredUserProfile.args = { | ||
...sidebarProfileProps, | ||
user: undefined, | ||
}; | ||
|
||
// Active Unregistered User Profile | ||
export const ActiveUnregisteredUserProfile = { ...SidebarProfileTemplate }; | ||
ActiveUnregisteredUserProfile.args = { | ||
...sidebarProfileProps, | ||
user: undefined, | ||
active: true, | ||
}; | ||
|
||
// User Profile with Long Name | ||
export const UserProfileWithLongName = { ...SidebarProfileTemplate }; | ||
UserProfileWithLongName.args = { | ||
...sidebarProfileProps, | ||
user: { | ||
_id: '650544eead52282dbf4397aa', | ||
email: '[email protected]', | ||
password: '$2a$05$7AnHdyBKd7kh78kkSt4OIOaBAidnedL3Sr6ZfFOKG5xcVatrPT4kq', | ||
isRegistered: true, | ||
fullName: 'Johnathan Doe the Third', | ||
username: 'john.doe.third', | ||
image: '/images/user-images/user-blue.png', | ||
}, | ||
}; | ||
|
||
// User Profile with No Image | ||
export const UserProfileWithNoImage = { ...SidebarProfileTemplate }; | ||
UserProfileWithNoImage.args = { | ||
...sidebarProfileProps, | ||
user: { | ||
_id: '650544eead52282dbf4397ab', | ||
email: '[email protected]', | ||
password: '$2a$05$7AnHdyBKd7kh78kkSt4OIOaBAidnedL3Sr6ZfFOKG5xcVatrPT4kq', | ||
isRegistered: true, | ||
fullName: 'Jane Doe', | ||
username: 'jane.doe', | ||
image: '', | ||
}, | ||
}; | ||
|
||
export default { | ||
title: 'widgets/Sidebar/SidebarProfile', | ||
component: SidebarProfile, | ||
tags: ['autodocs'], | ||
} as Meta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters