You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/30 16:42:56 UTC

[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar

e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984774818


##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
  * limitations under the License.
  *
  */
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
 import '@/styles/nav.scss'
 import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
 import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
 
 const Nav = () => {
+  const uiContext = useContext(UIContext)
+  const [menuClass, setMenuClass] = useState('navbarMenuButton')
+  const size = useWindowSize()
+
+  const toggleSidebarOpen = (open) => {
+    uiContext.changeSidebarVisibility(open)
+    setMenuClass((_) =>

Review Comment:
   There is an underscore `_` here being used to indicate the current state of `menuClass`. `mC` maybe a better alias, but since we're not referencing it we could just drop the underscore altogether.
   
   ```suggestion
       setMenuClass(() =>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org