mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
chore: fix lint and refactor some site code (#40185)
* chore: refactor header code style * fix lint
This commit is contained in:
parent
716e56b3ae
commit
fdc6709977
@ -61,15 +61,15 @@ export function getEcosystemGroup(): Exclude<MenuProps['items'], undefined> {
|
||||
}
|
||||
|
||||
export default (props: SharedProps) => {
|
||||
const downstyle = props.isRTL ? '-1px 2px 0 0' : '-1px 0 0 2px';
|
||||
const downStyle = props.isRTL ? '-1px 2px 0 0' : '-1px 0 0 2px';
|
||||
return (
|
||||
<Dropdown menu={{ items: getEcosystemGroup() }} placement="bottomRight">
|
||||
<Button size="small" className="header-button">
|
||||
<Button size="small">
|
||||
<FormattedMessage id="app.header.menu.more" />
|
||||
<DownOutlined
|
||||
style={{
|
||||
fontSize: '9px',
|
||||
margin: downstyle,
|
||||
margin: downStyle,
|
||||
verticalAlign: 'middle',
|
||||
}}
|
||||
/>
|
||||
|
@ -20,8 +20,6 @@ import SwitchBtn from './SwitchBtn';
|
||||
const RESPONSIVE_XS = 1120;
|
||||
const RESPONSIVE_SM = 1200;
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
const antdVersion: string = packageJson.version;
|
||||
|
||||
const useStyle = () => {
|
||||
@ -244,14 +242,12 @@ const Header: React.FC = () => {
|
||||
[antdVersion]: antdVersion,
|
||||
...themeConfig?.docVersions,
|
||||
};
|
||||
const versionOptions = Object.keys(docVersions).map((version) => (
|
||||
<Option value={docVersions[version]} key={version}>
|
||||
{version}
|
||||
</Option>
|
||||
));
|
||||
const versionOptions = Object.keys(docVersions).map((version) => ({
|
||||
value: docVersions[version],
|
||||
label: version,
|
||||
}));
|
||||
|
||||
const isHome = ['', 'index', 'index-cn'].includes(pathname);
|
||||
|
||||
const isZhCN = lang === 'cn';
|
||||
const isRTL = direction === 'rtl';
|
||||
let responsive: null | 'narrow' | 'crowded' = null;
|
||||
@ -284,7 +280,7 @@ const Header: React.FC = () => {
|
||||
/>
|
||||
);
|
||||
|
||||
let menu: React.ReactNode[] = [
|
||||
let menu = [
|
||||
navigationNode,
|
||||
<Select
|
||||
key="version"
|
||||
@ -295,9 +291,8 @@ const Header: React.FC = () => {
|
||||
dropdownStyle={getDropdownStyle}
|
||||
dropdownMatchSelectWidth={false}
|
||||
getPopupContainer={(trigger) => trigger.parentNode}
|
||||
>
|
||||
{versionOptions}
|
||||
</Select>,
|
||||
options={versionOptions}
|
||||
/>,
|
||||
<More key="more" {...sharedProps} />,
|
||||
<SwitchBtn
|
||||
key="lang"
|
||||
|
Loading…
Reference in New Issue
Block a user