forked from ddrilling/asb_cloud_front
Улучшен вид UserView
This commit is contained in:
parent
567e6c4510
commit
a22b043af9
@ -1,4 +1,4 @@
|
||||
import { memo } from 'react'
|
||||
import { HTMLProps, memo } from 'react'
|
||||
import { Tooltip } from 'antd'
|
||||
import { UserOutlined } from '@ant-design/icons'
|
||||
|
||||
@ -6,33 +6,58 @@ import { UserDto } from '@api'
|
||||
import { Grid, GridItem } from '@components/Grid'
|
||||
import { CompanyView } from './CompanyView'
|
||||
|
||||
export type UserViewProps = {
|
||||
user?: UserDto
|
||||
export type UserViewProps = HTMLProps<HTMLSpanElement> & {
|
||||
user?: UserDto
|
||||
}
|
||||
|
||||
export const UserView = memo<UserViewProps>(({ user }) => user ? (
|
||||
<Tooltip title={(
|
||||
<Grid style={{ columnGap: '8px' }}>
|
||||
<GridItem row={1} col={1}>Фамилия:</GridItem>
|
||||
<GridItem row={1} col={2}>{user?.surname}</GridItem>
|
||||
export const UserView = memo<UserViewProps>(({ user, ...other }) =>
|
||||
user ? (
|
||||
<Tooltip
|
||||
title={
|
||||
<Grid style={{ columnGap: '8px' }}>
|
||||
<GridItem row={1} col={1}>
|
||||
Фамилия:
|
||||
</GridItem>
|
||||
<GridItem row={1} col={2}>
|
||||
{user?.surname}
|
||||
</GridItem>
|
||||
|
||||
<GridItem row={2} col={1}>Имя:</GridItem>
|
||||
<GridItem row={2} col={2}>{user?.name}</GridItem>
|
||||
<GridItem row={2} col={1}>
|
||||
Имя:
|
||||
</GridItem>
|
||||
<GridItem row={2} col={2}>
|
||||
{user?.name}
|
||||
</GridItem>
|
||||
|
||||
<GridItem row={3} col={1}>Отчество:</GridItem>
|
||||
<GridItem row={3} col={2}>{user?.patronymic}</GridItem>
|
||||
<GridItem row={3} col={1}>
|
||||
Отчество:
|
||||
</GridItem>
|
||||
<GridItem row={3} col={2}>
|
||||
{user?.patronymic}
|
||||
</GridItem>
|
||||
|
||||
<GridItem row={4} col={1}>Компания:</GridItem>
|
||||
<GridItem row={4} col={2}>
|
||||
<CompanyView company={user?.company}/>
|
||||
</GridItem>
|
||||
</Grid>
|
||||
)}>
|
||||
<UserOutlined style={{ marginRight: 8 }}/>
|
||||
{user?.login}
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Tooltip title='нет пользователя'>-</Tooltip>
|
||||
))
|
||||
<GridItem row={4} col={1}>
|
||||
Компания:
|
||||
</GridItem>
|
||||
<GridItem row={4} col={2}>
|
||||
<CompanyView company={user?.company} />
|
||||
</GridItem>
|
||||
</Grid>
|
||||
}
|
||||
>
|
||||
<span {...other}>
|
||||
<UserOutlined style={{ marginRight: 8 }} />
|
||||
{user?.login}
|
||||
</span>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Tooltip title={'нет пользователя'}>
|
||||
<span {...other}>
|
||||
<UserOutlined style={{ marginRight: 8 }} />
|
||||
---
|
||||
</span>
|
||||
</Tooltip>
|
||||
)
|
||||
)
|
||||
|
||||
export default UserView
|
||||
|
Loading…
Reference in New Issue
Block a user