mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-06 02:38:00 +08:00
b3956a9ba2
* docs: fix Rate demo type for strict mode * Apply suggestions from code review Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: afc163 <afc163@gmail.com> --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: lijianan <574980606@qq.com>
22 lines
544 B
TypeScript
22 lines
544 B
TypeScript
import React from 'react';
|
|
import { FrownOutlined, MehOutlined, SmileOutlined } from '@ant-design/icons';
|
|
import { Rate } from 'antd';
|
|
|
|
const customIcons: Record<number, React.ReactNode> = {
|
|
1: <FrownOutlined />,
|
|
2: <FrownOutlined />,
|
|
3: <MehOutlined />,
|
|
4: <SmileOutlined />,
|
|
5: <SmileOutlined />,
|
|
};
|
|
|
|
const App: React.FC = () => (
|
|
<>
|
|
<Rate defaultValue={2} character={({ index = 0 }) => index + 1} />
|
|
<br />
|
|
<Rate defaultValue={3} character={({ index = 0 }) => customIcons[index + 1]} />
|
|
</>
|
|
);
|
|
|
|
export default App;
|