diff --git a/web/app-list/app-list-header.react.js b/web/app-list/app-list-header.react.js
--- a/web/app-list/app-list-header.react.js
+++ b/web/app-list/app-list-header.react.js
@@ -4,8 +4,7 @@
import { useModalContext } from 'lib/components/modal-provider.react.js';
-import css from './app-list-header.css';
-import AddButton from '../components/add-button.react.js';
+import PanelHeader from '../components/panel-header.react.js';
import AppsDirectory from '../modals/apps/apps-directory-modal.react.js';
function AppListHeader(): React.Node {
@@ -16,12 +15,7 @@
[pushModal],
);
- return (
-
- );
+ return ;
}
export default AppListHeader;
diff --git a/web/app-list/app-list-header.css b/web/components/panel-header.css
rename from web/app-list/app-list-header.css
rename to web/components/panel-header.css
--- a/web/app-list/app-list-header.css
+++ b/web/components/panel-header.css
@@ -2,7 +2,8 @@
display: flex;
justify-content: space-between;
align-items: center;
- padding: 16px;
+ padding: 0 16px;
+ height: 100%;
}
.headerLabel {
diff --git a/web/components/panel-header.react.js b/web/components/panel-header.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/panel-header.react.js
@@ -0,0 +1,37 @@
+// @flow
+
+import * as React from 'react';
+
+import css from './panel-header.css';
+import AddButton from '../components/add-button.react.js';
+
+type Props = {
+ +headerLabel: string,
+ +onClickAddButton?: () => mixed,
+};
+
+function PanelHeader(props: Props): React.Node {
+ const { headerLabel, onClickAddButton } = props;
+
+ const addButton = React.useMemo(() => {
+ if (!onClickAddButton) {
+ return null;
+ }
+
+ return ;
+ }, [onClickAddButton]);
+
+ const panelHeader = React.useMemo(
+ () => (
+
+
{headerLabel}
+ {addButton}
+
+ ),
+ [addButton, headerLabel],
+ );
+
+ return panelHeader;
+}
+
+export default PanelHeader;