Procházet zdrojové kódy

feat: Let the top navigation bar open in a tab when you right click on it #3018 (#3486)

### What problem does this PR solve?

feat: Let the top navigation bar open in a tab when you right click on
it #3018

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
tags/v0.14.0
balibabu před 11 měsíci
rodič
revize
31decadd8e
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 4
- 1
web/src/layouts/components/header/index.less Zobrazit soubor

} }


.radioGroup { .radioGroup {
& > label {
& label {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
border: 0 !important; border: 0 !important;
} }
:global(.ant-radio-button-wrapper-checked) { :global(.ant-radio-button-wrapper-checked) {
border-radius: 6px !important; border-radius: 6px !important;
& a {
color: white;
}
} }
} }



+ 24
- 16
web/src/layouts/components/header/index.tsx Zobrazit soubor

import { useNavigateWithFromState } from '@/hooks/route-hook'; import { useNavigateWithFromState } from '@/hooks/route-hook';
import { MessageOutlined, SearchOutlined } from '@ant-design/icons'; import { MessageOutlined, SearchOutlined } from '@ant-design/icons';
import { Flex, Layout, Radio, Space, theme } from 'antd'; import { Flex, Layout, Radio, Space, theme } from 'antd';
import { useCallback, useMemo } from 'react';
import { MouseEventHandler, useCallback, useMemo } from 'react';
import { useLocation } from 'umi'; import { useLocation } from 'umi';
import Toolbar from '../right-toolbar'; import Toolbar from '../right-toolbar';


); );
}, [pathname, tagsData]); }, [pathname, tagsData]);


const handleChange = (path: string) => {
navigate(path);
};
const handleChange = useCallback(
(path: string): MouseEventHandler =>
(e) => {
e.preventDefault();
navigate(path);
},
[navigate],
);


const handleLogoClick = useCallback(() => { const handleLogoClick = useCallback(() => {
navigate('/'); navigate('/');
value={currentPath} value={currentPath}
> >
{tagsData.map((item) => ( {tagsData.map((item) => (
<Radio.Button
value={item.name}
onClick={() => handleChange(item.path)}
key={item.name}
>
<Flex align="center" gap={8}>
<item.icon
className={styles.radioButtonIcon}
stroke={item.name === currentPath ? 'black' : 'white'}
></item.icon>
{item.name}
</Flex>
<Radio.Button value={item.name} key={item.name}>
<a href={item.path}>
<Flex
align="center"
gap={8}
onClick={handleChange(item.path)}
className="cursor-pointer"
>
<item.icon
className={styles.radioButtonIcon}
stroke={item.name === currentPath ? 'black' : 'white'}
></item.icon>
{item.name}
</Flex>
</a>
</Radio.Button> </Radio.Button>
))} ))}
</Radio.Group> </Radio.Group>

Načítá se…
Zrušit
Uložit