From 7e30ad69229938c89e213ac91af3ca682ee17252 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Fri, 11 Nov 2022 15:34:38 +0800 Subject: [PATCH] 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 --- src/components/Layout/GlobalNav/Left/index.jsx | 5 ++++- src/components/Layout/GlobalNav/Right/index.jsx | 7 +++++-- src/components/Layout/GlobalNav/Right/index.less | 4 ++++ src/components/Layout/GlobalNav/index.jsx | 5 ++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/Layout/GlobalNav/Left/index.jsx b/src/components/Layout/GlobalNav/Left/index.jsx index 62144c87..e5dd7a26 100644 --- a/src/components/Layout/GlobalNav/Left/index.jsx +++ b/src/components/Layout/GlobalNav/Left/index.jsx @@ -21,7 +21,10 @@ import styles from './index.less'; export default class Left extends React.Component { static propTypes = { - items: PropTypes.arrayOf(navItemPropType), + items: PropTypes.oneOfType([ + PropTypes.arrayOf(navItemPropType), + PropTypes.array, + ]), onClose: PropTypes.func, }; diff --git a/src/components/Layout/GlobalNav/Right/index.jsx b/src/components/Layout/GlobalNav/Right/index.jsx index 2d40533b..1be888e2 100644 --- a/src/components/Layout/GlobalNav/Right/index.jsx +++ b/src/components/Layout/GlobalNav/Right/index.jsx @@ -24,7 +24,10 @@ const { Search } = Input; export default class Right extends React.Component { static propTypes = { - items: PropTypes.arrayOf(navItemPropType), + items: PropTypes.oneOfType([ + PropTypes.arrayOf(navItemPropType), + PropTypes.array, + ]), onClose: PropTypes.func, }; @@ -98,7 +101,7 @@ export default class Right extends React.Component { const { name = '' } = item || {}; return ( -
+
{name}
{this.renderNavItemChildren(item)} diff --git a/src/components/Layout/GlobalNav/Right/index.less b/src/components/Layout/GlobalNav/Right/index.less index f38b8a8b..a4dd302b 100644 --- a/src/components/Layout/GlobalNav/Right/index.less +++ b/src/components/Layout/GlobalNav/Right/index.less @@ -28,6 +28,10 @@ line-height: 32px; cursor: pointer; + a { + display: block; + } + &:hover { background-color: rgba(0, 0, 0, 5%); } diff --git a/src/components/Layout/GlobalNav/index.jsx b/src/components/Layout/GlobalNav/index.jsx index b6f6e739..ff387057 100644 --- a/src/components/Layout/GlobalNav/index.jsx +++ b/src/components/Layout/GlobalNav/index.jsx @@ -26,7 +26,10 @@ import styles from './index.less'; export class GlobalNav extends React.Component { static propTypes = { - navItems: PropTypes.arrayOf(navItemPropType), + navItems: PropTypes.oneOfType([ + PropTypes.arrayOf(navItemPropType), + PropTypes.array, + ]), }; static defaultProps = {