-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
476 additions
and
10 deletions.
There are no files selected for viewing
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
6 changes: 6 additions & 0 deletions
6
src/components/Sider/ContactSider/ContactItem/index.module.less
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,6 @@ | ||
@import url("@/themes/index.less"); | ||
|
||
.contactItem { | ||
padding: 10px; | ||
background-color: @colorPrimary; | ||
} |
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,48 @@ | ||
import { Badge, Flex, Typography } from 'antd' | ||
import { useNavigate } from 'react-router-dom' | ||
import { useMeasure } from 'react-use' | ||
import styles from './index.module.less' | ||
import type { Contact } from '@/typings' | ||
import { useThemeToken, useTime } from '@/hooks' | ||
|
||
interface ContactItemProps { | ||
contact: Contact | ||
} | ||
|
||
function ContactItem({ contact }: ContactItemProps) { | ||
const [ref, { width }] = useMeasure<HTMLDivElement>() | ||
const { token } = useThemeToken() | ||
const time = useTime() | ||
const { updatedAt, avatar, sender, count, note, nickname, message } = contact | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<Flex | ||
ref={ref} | ||
onClick={() => { | ||
navigate(`/contact/${contact.id}`) | ||
}} | ||
gap={10} | ||
className={styles.contactItem} | ||
> | ||
<div style={{ minWidth: 50, height: 50, borderRadius: '50%', overflow: 'hidden' }}> | ||
<img src={avatar} /> | ||
</div> | ||
<Flex vertical style={{ width: width - 60 }} justify="space-between"> | ||
<Flex justify="space-between" align="center"> | ||
<Typography.Text ellipsis style={{ fontSize: token.fontSizeLG }}>{note || nickname}</Typography.Text> | ||
<Typography.Text type="secondary" style={{ fontSize: token.fontSizeSM, flexShrink: 0 }}>{time(updatedAt).fromNow()}</Typography.Text> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Typography.Text ellipsis> | ||
{sender ? `${sender}:` : ''} | ||
{message} | ||
</Typography.Text> | ||
<Badge style={{ boxShadow: 'none' }} count={count} /> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
) | ||
} | ||
|
||
export default ContactItem |
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,14 @@ | ||
.sider { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
|
||
.topBar { | ||
padding: 20px 10px; | ||
background-color: #fff; | ||
} | ||
|
||
.list { | ||
flex: 1; | ||
} | ||
} |
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
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
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,9 @@ | ||
import React from 'react' | ||
|
||
function ContactDetail() { | ||
return ( | ||
<div>ContactDetail</div> | ||
) | ||
} | ||
|
||
export default ContactDetail |
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,7 @@ | ||
function ContactSearch() { | ||
return ( | ||
<div>ContactSearch</div> | ||
) | ||
} | ||
|
||
export default ContactSearch |
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
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
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,12 @@ | ||
@scrollbar-height: var(--scrollbar-height); | ||
@scrollbar-color: var(--scrollbar-color); | ||
@scrollbar-track-color: var(--scrollbar-track-color); | ||
@scrollbar-hover-color: var(--scrollbar-hover-color); | ||
@scrollbar-border-radius: var(--scrollbar-border-radius); | ||
@transition: var(--motionDurationMid) var(--motionEaseInOut); | ||
@boxShadow: var(--box-shadow); | ||
@boxShadowSecondary: var(--boxShadowSecondary); | ||
@boxShadowCard: var(--boxShadowCard); | ||
@headerHeight: var(--header-height); | ||
@colorBorderBg: var(--colorBorderBg); | ||
@colorBgTextHover: var(--colorBgTextHover); |
Oops, something went wrong.