2023-06-05 00:51:16 +08:00
|
|
|
import React from 'react';
|
2024-02-04 17:08:39 +08:00
|
|
|
import Icon from '@ant-design/icons';
|
2023-07-28 16:17:43 +08:00
|
|
|
import type { DirectionType } from 'antd/es/config-provider';
|
2023-06-05 00:51:16 +08:00
|
|
|
|
|
|
|
const ltrD =
|
|
|
|
'M448 64l512 0 0 128-128 0 0 768-128 0 0-768-128 0 0 768-128 0 0-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM64 448l256 224-256 224z';
|
2024-02-04 17:08:39 +08:00
|
|
|
|
2023-06-05 00:51:16 +08:00
|
|
|
const rtlD =
|
|
|
|
'M256 64l512 0 0 128-128 0 0 768-128 0 0-768-128 0 0 768-128 0 0-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM960 896l-256-224 256-224z';
|
|
|
|
|
2024-02-04 17:08:39 +08:00
|
|
|
interface DirectionIconProps {
|
|
|
|
className?: string;
|
|
|
|
direction?: DirectionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DirectionSvg: React.FC<DirectionIconProps> = (props) => {
|
|
|
|
const { direction } = props;
|
|
|
|
return (
|
|
|
|
<svg viewBox="0 0 1024 1024" fill="currentColor">
|
|
|
|
<path d={direction === 'ltr' ? ltrD : rtlD} />
|
|
|
|
</svg>
|
|
|
|
);
|
|
|
|
};
|
2024-02-02 11:17:28 +08:00
|
|
|
|
2024-02-04 17:08:39 +08:00
|
|
|
const DirectionIcon: React.FC<DirectionIconProps> = (props) => (
|
2024-02-02 11:17:28 +08:00
|
|
|
<Icon {...props} component={() => <DirectionSvg direction={props.direction} />} />
|
2023-06-05 00:51:16 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
export default DirectionIcon;
|