diff --git a/components/header-bar/package.json b/components/header-bar/package.json
index cf315fc441..a5c0a6b84e 100644
--- a/components/header-bar/package.json
+++ b/components/header-bar/package.json
@@ -22,7 +22,7 @@
"access": "public"
},
"scripts": {
- "start": "start-storybook -c ../../storybook/config --port 5005",
+ "start": "start-storybook -c ../../storybook/config --port 5000",
"build": "d2-app-scripts build",
"test": "d2-app-scripts test --jestConfig ../../jest.config.shared.js"
},
@@ -46,6 +46,7 @@
"@dhis2-ui/logo": "9.2.0",
"@dhis2-ui/menu": "9.2.0",
"@dhis2-ui/modal": "9.2.0",
+ "@dhis2-ui/popper": "9.2.0",
"@dhis2-ui/user-avatar": "9.2.0",
"@dhis2/prop-types": "^3.1.2",
"@dhis2/ui-constants": "9.2.0",
diff --git a/components/header-bar/src/apps.js b/components/header-bar/src/apps.js
index e5e9c00095..f705d9e9fd 100755
--- a/components/header-bar/src/apps.js
+++ b/components/header-bar/src/apps.js
@@ -1,10 +1,12 @@
import { Card } from '@dhis2-ui/card'
import { InputField } from '@dhis2-ui/input'
+import { Layer } from '@dhis2-ui/layer'
+import { Popper } from '@dhis2-ui/popper'
import { useConfig } from '@dhis2/app-runtime'
import { colors, spacers, theme } from '@dhis2/ui-constants'
import { IconApps24, IconSettings24 } from '@dhis2/ui-icons'
import PropTypes from 'prop-types'
-import React, { useState, useEffect, useCallback, useRef } from 'react'
+import React, { useState, useCallback, useRef } from 'react'
import { Link, useInRouterContext } from 'react-router-dom'
import css from 'styled-jsx/css'
import { joinPath } from './join-path.js'
@@ -215,14 +217,6 @@ const AppMenu = ({ apps, filter, onFilterChange }) => (
-
-
)
@@ -236,22 +230,13 @@ const Apps = ({ apps }) => {
const [show, setShow] = useState(false)
const [filter, setFilter] = useState('')
- const handleVisibilityToggle = useCallback(() => setShow(!show), [show])
+ const handleVisibilityToggle = useCallback(() => setShow((s) => !s), [])
const handleFilterChange = useCallback(({ value }) => setFilter(value), [])
- const containerEl = useRef(null)
- const onDocClick = useCallback((evt) => {
- if (containerEl.current && !containerEl.current.contains(evt.target)) {
- setShow(false)
- }
- }, [])
- useEffect(() => {
- document.addEventListener('click', onDocClick)
- return () => document.removeEventListener('click', onDocClick)
- }, [onDocClick])
+ const containerRef = useRef(null)
return (
-