Skip to content

Commit

Permalink
feat: ✨ friends组件
Browse files Browse the repository at this point in the history
  • Loading branch information
G committed Jan 2, 2024
1 parent e348a3d commit 5f92ffc
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 25 deletions.
128 changes: 104 additions & 24 deletions apps/admin/src/views/user/components/friends/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,110 @@
import { Card, Checkbox, Col, Row, Select, Switch } from 'antd';
import { DeleteOutlined, EditOutlined, MoreOutlined } from '@ant-design/icons';
import { Avatar, Button, Card, Col, Dropdown, Flex, Row, Space, Typography } from 'antd';
import { SvgIcon } from 'ui';

import travel_3 from '@/assets/images/travel_3.jpg';

import useStyles from '../styles';

import type { MenuProps } from 'antd';
import type { FC } from 'react';

const { Title, Text } = Typography;

export interface PFriendsItem {
avatar: string;
name: string;
title: string;
}

export interface PFriends {}
const Friends: FC<PFriends> = () => (
<>
<Row gutter={[16, 16]}>
<Col span={12}>
<Card>
<Checkbox>Checkbox</Checkbox>
<Select
defaultValue='lucy'
style={{ width: 120 }}
options={[
{ value: 'jack', label: 'Jack' },
{ value: 'lucy', label: 'Lucy' },
{ value: 'Yiminghe', label: 'yiminghe' },
{ value: 'disabled', label: 'Disabled', disabled: true },
]}
/>
<Switch defaultChecked />
</Card>
</Col>
<Col span={12}></Col>
</Row>
</>
);
const Friends: FC<PFriends> = () => {
const { styles, cx } = useStyles();
const items: MenuProps['items'] = [
{
key: '1',
label: (
<Space size={8}>
<DeleteOutlined rev={undefined} />
<span>删除</span>
</Space>
),
},
{
key: '2',
label: (
<Space size={8}>
<EditOutlined rev={undefined} />
<span>修改</span>
</Space>
),
},
];
const onClick: MenuProps['onClick'] = ({ key }) => {
switch (key) {
case 'lock':
break;
case 'logout':
break;
default:
break;
}
};

const FriendData: PFriendsItem[] = [
{
avatar: travel_3,
name: 'Gbeata',
title: '来历不明',
},
{
avatar: travel_3,
name: 'Gbeata',
title: '来历不明',
},
{
avatar: travel_3,
name: 'Gbeata',
title: '来历不明',
},
{
avatar: travel_3,
name: 'Gbeata',
title: '来历不明',
},
];
return (
<>
<Row gutter={[16, 16]}>
{FriendData.map((item, index) => (
<Col span={8} key={index}>
<Card>
<Dropdown menu={{ items, onClick }} placement='bottomRight' arrow>
<Button
className={cx(styles['card-action'])}
shape='circle'
type='text'
icon={<MoreOutlined />}
></Button>
</Dropdown>
<Flex gap={8} vertical align={'center'}>
<Avatar size={64} src={item.avatar} />
<Title style={{ margin: 0 }} level={5}>
{item.name}
</Title>
<Text type='secondary'>{item.title}</Text>
<Flex style={{ marginTop: 8 }} gap={8}>
<Button shape='circle' icon={<SvgIcon style={{ color: '#1890ff' }} name='github' />} />
<Button shape='circle' icon={<SvgIcon name='message' />} />
<Button shape='circle' icon={<SvgIcon name='like' />} />
</Flex>
</Flex>
</Card>
</Col>
))}
</Row>
</>
);
};

export default Friends;
2 changes: 1 addition & 1 deletion apps/admin/src/views/user/components/proFile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import travel_3 from '@/assets/images/travel_3.jpg';

import Message from '../message';
import SendBox from '../sendBox';
import useStyles from './styles';
import useStyles from '../styles';

import type { PMessage } from '../message';
import type { FC } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const useStyles = createStyles(({ token }) => ({
'custom-image': {
borderRadius: token.borderRadiusLG,
},
'card-action': {
position: 'absolute',
right: token.paddingSM,
top: token.paddingSM,
},
}));

export default useStyles;

0 comments on commit 5f92ffc

Please sign in to comment.