forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate less to token for DatePicker (ant-design#42607)
* feat: migrate less to token for time-picker * feat: add component-token demo * feat:update token with API Naming rules * feat: migrate less to token for Time-pikker * chore: code clean * chore: code clean * chore: udpate * feat: picker token * chore: add comment --------- Co-authored-by: MadCcc <1075746765@qq.com>
- Loading branch information
Showing
10 changed files
with
285 additions
and
114 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { extendTest } from '../../../tests/shared/demoTest'; | ||
|
||
extendTest('date-picker', { skip: ['locale.tsx'] }); | ||
extendTest('date-picker', { skip: ['locale.tsx', 'component-token.tsx'] }); |
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,7 @@ | ||
## zh-CN | ||
|
||
Component Token Debug. | ||
|
||
## en-US | ||
|
||
Component Token Debug. |
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,51 @@ | ||
import React from 'react'; | ||
import type { DatePickerProps } from 'antd'; | ||
import { ConfigProvider, DatePicker, Space, TimePicker } from 'antd'; | ||
import dayjs from 'dayjs'; | ||
|
||
/** Test usage. Do not use in your production. */ | ||
|
||
const { RangePicker } = DatePicker; | ||
|
||
const onChange: DatePickerProps['onChange'] = (date, dateString) => { | ||
console.log(date, dateString); | ||
}; | ||
|
||
const App: React.FC = () => ( | ||
<ConfigProvider | ||
theme={{ | ||
components: { | ||
DatePicker: { | ||
presetsWidth: 160, | ||
zIndexPopup: 888, | ||
cellHoverWithRangeBg: '#f0f0f0', | ||
cellActiveWithRangeBg: '#e6bbff', | ||
cellRangeBorderColor: 'green', | ||
timeColumnWidth: 80, | ||
timeColumnHeight: 250, | ||
timeCellHeight: 30, | ||
cellWidth: 64, | ||
cellHeight: 40, | ||
textHeight: 45, | ||
withoutTimeCellHeight: 70, | ||
}, | ||
}, | ||
}} | ||
> | ||
<Space direction="vertical"> | ||
<DatePicker | ||
presets={[ | ||
{ label: 'Yesterday', value: dayjs().add(-1, 'd') }, | ||
{ label: 'Last Week', value: dayjs().add(-7, 'd') }, | ||
{ label: 'Last Month', value: dayjs().add(-1, 'month') }, | ||
]} | ||
onChange={onChange} | ||
/> | ||
<RangePicker /> | ||
<TimePicker onChange={onChange} /> | ||
<DatePicker onChange={onChange} picker="month" /> | ||
</Space> | ||
</ConfigProvider> | ||
); | ||
|
||
export default App; |
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
Oops, something went wrong.