import React, { useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import UserListItem from './UserListItem'; import ScrollableContainer from '../../components/containers/ScrollableContainer/ScrollableContainer'; const meta = { title: '@quickblox-react-ui-kit/Presentation/ui-components/UserListItem', component: UserListItem, tags: ['autodocs'], parameters: { layout: 'centered', }, args: { className: '', disabled: false, checked: false, userName: '', avatarUrl: '', }, argTypes: { avatarUrl: { table: { type: { summary: 'url' }, }, description: 'Avatar image source', }, userName: { table: { type: { summary: 'string' }, defaultValue: { summary: '', }, }, description: 'User name', }, disabled: { table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false', }, }, description: 'Active', }, checked: { table: { type: { summary: 'boolean' }, defaultValue: { summary: 'true', }, }, description: 'Checkbox', }, onChange: { table: { defaultValue: { summary: '(checked: boolean) => void', }, type: { summary: 'function' }, }, description: 'Checkbox control', }, className: { table: { defaultValue: { summary: 'string', }, type: { summary: 'string' }, }, description: 'Additional classes', }, }, } satisfies Meta; export default meta; type StoryDefault = StoryObj; function UserListExample() { const [users, setUser] = useState([ { name: 'User 1', id: 0, checked: true }, { name: 'User 2', id: 1, checked: false }, { name: 'User 3', id: 2, checked: false }, { name: 'User 4', id: 3, checked: true }, { name: 'User 5', id: 4, checked: true }, ]); const handleRenderUserListItem = (user: { name: string; id: number; checked: boolean; }) => { return ( { setUser((prevUsers) => prevUsers.map((prevUser) => prevUser.id === user.id ? { ...prevUser, checked: value } : prevUser, ), ); }} /> ); }; return ( ); } function UserListItemExample() { const [checked, setChecked] = useState(false) return ( { setChecked(value); }} /> ) } export const UserListItemDefault: StoryDefault = { name: 'UserListItem Default', render: () => }; export const UserList: StoryDefault = { name: 'UserListItem Multiple', render: () => , };