Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/eagle/src/antd.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
DatePicker,
DatePicker as AntdDatePicker,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是直接透穿的,那就叫 antdatepicker 就好了,原来的可以保持不变,不然这样其他使用 eagle 的地方一升级就 breaking change 了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

List,
Menu,
Modal,
Expand All @@ -19,12 +19,14 @@ export {
Button as AntdButton,
Checkbox as AntdCheckbox,
Collapse as AntdCollapse,
DatePicker as AntdDatePicker,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我就没太理解了,我们到底是对外提供项目内的 datapicker 还是 antd 的?

Divider as AntdDivider,
Drawer as AntdDrawer,
Empty as AntdEmpty,
Input as AntdInput,
message as AntdMessage,
Select as AntdSelect,
Skeleton as AntdSkeleton,
Steps as AntdSteps,
Switch as AntdSwitch,
Table as AntdTable,
Expand All @@ -33,22 +35,20 @@ export {
TreeSelect as AntdTreeSelect,
AutoComplete,
Col,
DatePicker,
Dropdown,
Layout,
List,
Menu,
Popover,
Row,
Skeleton as AntdSkeleton,
Tabs,
Timeline,
Tree,
Typography,
Upload,
} from "antd";

export const DatePickerRangePicker = DatePicker.RangePicker;
export const DatePickerRangePicker = AntdDatePicker.RangePicker;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

export const ListItem = List.Item;
export const MenuItemGroup =
Menu.ItemGroup as React.ComponentType<MenuItemGroupProps>;
Expand Down
28 changes: 28 additions & 0 deletions packages/eagle/src/core/DatePicker/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { InputStyle } from "@src/core/Styled";
import { Typo } from "@src/core/Typo";
import { DatePicker as AntdDatePicker } from "antd";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新组件,为什么不能直接使用 antd5 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thread里有说,两种方案,要不就最小花销,只提供error的渲染能力,要不就直接引入antd5的组件,目前就最小花销的方式处理,我看thread里没有异议呀

import { DatePickerProps } from "antd/lib/date-picker";
import cs from "classnames";
import React from "react";
const DatePicker: React.FC<DatePickerProps & { error?: boolean }> = ({
className,
error,
size = "middle",
...props
}) => {
const typo = {
large: Typo.Label.l2_regular,
middle: Typo.Label.l3_regular,
small: Typo.Label.l4_regular,
}[size];
return (
<AntdDatePicker
{...props}
size={size}
data-test={props.name}
className={cs(className, InputStyle, typo, error ? "error" : "")}
/>
);
};

export default DatePicker;
Loading
Loading