ant-design/.dumi/theme/slots/Header/More.tsx
MadCcc e96059cd76
docs: migrate to antd-style (#43623)
* docs: migrate to antd-style

* [CodeFactor] Apply fixes

* chore: code clean

* chore: lint

* chore: try cache

* chore: try

* fix: ssr

* chore: code clean

---------

Co-authored-by: codefactor-io <support@codefactor.io>
2023-07-20 19:27:33 +08:00

94 lines
2.2 KiB
TypeScript

import { DownOutlined } from '@ant-design/icons';
import { createStyles } from 'antd-style';
import type { MenuProps } from 'antd';
import { Button, Dropdown } from 'antd';
import { FormattedMessage } from 'dumi';
import React from 'react';
import type { SharedProps } from './interface';
const useStyle = createStyles(({ css }) => ({
smallStyle: css`
font-size: 12px;
color: #777;
margin-left: 0.3em;
`,
downOutlined: css`
font-size: 9px;
margin: -1px 0 0 2px;
vertical-align: middle;
`,
downOutlinedRTL: css`
font-size: 9px;
margin: -1px 2px 0 0;
vertical-align: middle;
`,
}));
const Community: React.FC = () => {
const { styles } = useStyle();
return (
<span className={styles.smallStyle}>
(<FormattedMessage id="app.implementation.community" />)
</span>
);
};
export const getEcosystemGroup = (): MenuProps['items'] => [
{
label: (
<a href="https://charts.ant.design" target="_blank" rel="noopener noreferrer">
<FormattedMessage id="app.header.menu.charts" />
</a>
),
key: 'charts',
},
{
label: (
<a href="http://pro.ant.design" target="_blank" rel="noopener noreferrer">
<FormattedMessage id="app.header.menu.pro.v4" />
</a>
),
key: 'pro',
},
{
label: (
<a href="http://procomponents.ant.design" target="_blank" rel="noopener noreferrer">
<FormattedMessage id="app.header.menu.pro.components" />
</a>
),
key: 'procomponents',
},
{
label: (
<a href="http://ng.ant.design" target="_blank" rel="noopener noreferrer">
Ant Design of Angular
<Community />
</a>
),
key: 'ng',
},
{
label: (
<a href="http://antdv.com" target="_blank" rel="noopener noreferrer">
Ant Design of Vue
<Community />
</a>
),
key: 'vue',
},
];
const More: React.FC<SharedProps> = ({ isRTL }) => {
const { styles } = useStyle();
return (
<Dropdown menu={{ items: getEcosystemGroup() }} placement="bottomRight">
<Button size="small">
<FormattedMessage id="app.header.menu.more" />
<DownOutlined className={isRTL ? styles.downOutlinedRTL : styles.downOutlined} />
</Button>
</Dropdown>
);
};
export default More;