feat: update the click area of links in the global navigation

1. Update the click area of the links in the global navigation
2. Update the proptype of the globalNav component

Change-Id: Ie9f12f2d6747429966e62bbc0bbd72d9686864cd
This commit is contained in:
Jingwei.Zhang 2022-11-11 15:34:38 +08:00
parent f89ffe6149
commit 7e30ad6922
4 changed files with 17 additions and 4 deletions

View File

@ -21,7 +21,10 @@ import styles from './index.less';
export default class Left extends React.Component { export default class Left extends React.Component {
static propTypes = { static propTypes = {
items: PropTypes.arrayOf(navItemPropType), items: PropTypes.oneOfType([
PropTypes.arrayOf(navItemPropType),
PropTypes.array,
]),
onClose: PropTypes.func, onClose: PropTypes.func,
}; };

View File

@ -24,7 +24,10 @@ const { Search } = Input;
export default class Right extends React.Component { export default class Right extends React.Component {
static propTypes = { static propTypes = {
items: PropTypes.arrayOf(navItemPropType), items: PropTypes.oneOfType([
PropTypes.arrayOf(navItemPropType),
PropTypes.array,
]),
onClose: PropTypes.func, onClose: PropTypes.func,
}; };
@ -98,7 +101,7 @@ export default class Right extends React.Component {
const { name = '' } = item || {}; const { name = '' } = item || {};
return ( return (
<div className={styles['nav-item']}> <div className={styles['nav-item']} key={item.name}>
<div className={styles.title}>{name}</div> <div className={styles.title}>{name}</div>
<div classnames={styles.children}> <div classnames={styles.children}>
{this.renderNavItemChildren(item)} {this.renderNavItemChildren(item)}

View File

@ -28,6 +28,10 @@
line-height: 32px; line-height: 32px;
cursor: pointer; cursor: pointer;
a {
display: block;
}
&:hover { &:hover {
background-color: rgba(0, 0, 0, 5%); background-color: rgba(0, 0, 0, 5%);
} }

View File

@ -26,7 +26,10 @@ import styles from './index.less';
export class GlobalNav extends React.Component { export class GlobalNav extends React.Component {
static propTypes = { static propTypes = {
navItems: PropTypes.arrayOf(navItemPropType), navItems: PropTypes.oneOfType([
PropTypes.arrayOf(navItemPropType),
PropTypes.array,
]),
}; };
static defaultProps = { static defaultProps = {