-
Notifications
You must be signed in to change notification settings - Fork 0
DateTime add error render ability #888
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { | ||
| DatePicker, | ||
| DatePicker as AntdDatePicker, | ||
| List, | ||
| Menu, | ||
| Modal, | ||
|
|
@@ -19,12 +19,14 @@ export { | |
| Button as AntdButton, | ||
| Checkbox as AntdCheckbox, | ||
| Collapse as AntdCollapse, | ||
| DatePicker as AntdDatePicker, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
|
|
@@ -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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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>; | ||
|
|
||
| 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"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 新组件,为什么不能直接使用 antd5 ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果是直接透穿的,那就叫 antdatepicker 就好了,原来的可以保持不变,不然这样其他使用 eagle 的地方一升级就 breaking change 了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的