Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Conversations style by RICH. #242

Merged
merged 11 commits into from
Nov 27, 2024
Binary file modified bun.lockb
Binary file not shown.
15 changes: 8 additions & 7 deletions components/conversations/GroupTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Divider, Typography } from 'antd';
import { Typography } from 'antd';
import type { ConfigProviderProps, GetProp } from 'antd';
import classnames from 'classnames';
import React from 'react';

export interface GroupTitleProps {
children?: React.ReactNode;
Expand All @@ -9,16 +10,16 @@ export interface GroupTitleProps {
// User should not care about internal state.
// Which should pass by context instead.
export const GroupTitleContext = React.createContext<{
direction?: GetProp<ConfigProviderProps, 'direction'>;
prefixCls?: GetProp<ConfigProviderProps, 'prefixCls'>;
}>(null!);

const GroupTitle: React.FC<GroupTitleProps> = ({ children }) => {
const { direction } = React.useContext(GroupTitleContext);
const { prefixCls } = React.useContext(GroupTitleContext);

return (
<Divider orientation={direction === 'rtl' ? 'right' : 'left'} plain>
{children && <Typography.Text type="secondary">{children}</Typography.Text>}
</Divider>
<div className={classnames(`${prefixCls}-group-title`)}>
{children && <Typography.Text>{children}</Typography.Text>}
</div>
);
};

Expand Down
10 changes: 5 additions & 5 deletions components/conversations/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { EllipsisOutlined } from '@ant-design/icons';
import { Dropdown, Tooltip, Typography } from 'antd';
import classnames from 'classnames';
import { Tooltip, Typography, Dropdown } from 'antd';
import { MoreOutlined } from '@ant-design/icons';
import React from 'react';

import type { MenuProps } from 'antd';
import type { DirectionType } from 'antd/es/config-provider';
import type { Conversation } from './interface';
import pickAttrs from 'rc-util/lib/pickAttrs';
import type { Conversation } from './interface';

export interface ConversationsItemProps
extends Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> {
Expand Down Expand Up @@ -87,7 +87,7 @@ const ConversationsItem: React.FC<ConversationsItemProps> = (props) => {
disabled={disabled}
onOpenChange={onOpenChange}
>
<MoreOutlined
<EllipsisOutlined
onClick={stopPropagation}
disabled={disabled}
className={`${prefixCls}-menu-icon`}
Expand Down
Loading