ant-design/components/date-picker/demo/cell-render.tsx
JiaQi f3c1871b20
chore: bump rc-picker (#44845)
* chore: bump rc-picker

* Update package.json

* Update cell-render.tsx

---------

Co-authored-by: 二货爱吃白萝卜 <smith3816@gmail.com>
Co-authored-by: lijianan <574980606@qq.com>
2023-09-14 14:56:57 +08:00

44 lines
1.2 KiB
TypeScript

import React from 'react';
import { DatePicker, Space } from 'antd';
const { RangePicker } = DatePicker;
const App: React.FC = () => (
<Space direction="vertical" size={12}>
<DatePicker
cellRender={(current, info) => {
if (info.type !== 'date') return info.originNode;
if (typeof current === 'number') {
return <div className="ant-picker-cell-inner">{current}</div>;
}
return (
<div
className="ant-picker-cell-inner"
style={current.date() === 1 ? { border: '1px solid #1677ff', borderRadius: '50%' } : {}}
>
{current.date()}
</div>
);
}}
/>
<RangePicker
cellRender={(current, info) => {
if (info.type !== 'date') return info.originNode;
if (typeof current === 'number') {
return <div className="ant-picker-cell-inner">{current}</div>;
}
return (
<div
className="ant-picker-cell-inner"
style={current.date() === 1 ? { border: '1px solid #1677ff', borderRadius: '50%' } : {}}
>
{current.date()}
</div>
);
}}
/>
</Space>
);
export default App;