diff --git a/web/src/Footer.js b/web/src/Footer.js
index 05fa7cf..68bf968 100644
--- a/web/src/Footer.js
+++ b/web/src/Footer.js
@@ -1,110 +1,85 @@
-import { XMarkIcon } from '@heroicons/react/24/outline'
-import React, { useState } from 'react';
+import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/24/outline';
+import React, { memo, useState, useCallback } from 'react';
import { GitRepositories, Kustomizations } from './FluxState';
-function Footer(props) {
- const { store } = props
+const Footer = memo(function Footer(props) {
+
+ const { store } = props;
- const [expanded, setExpanded] = useState(true);
+ const [expanded, setExpanded] = useState(false);
const [fluxState, setFluxState] = useState(store.getState().fluxState);
store.subscribe(() => setFluxState(store.getState().fluxState))
- return (
- <>
- { expanded ?
- :
-
- }
- >
- )
-}
-
-function ExpandedFooter(props) {
- const { fluxState, setExpanded } = props;
-
// https://blog.stackademic.com/building-a-resizable-sidebar-component-with-persisting-width-using-react-tailwindcss-bdec28a594f
const navigationDefault = [
- { name: 'Kustomizations', href: '#', count: 10, current: true },
- { name: 'Sources', href: '#', count: '5', current: false },
- { name: 'Runtime', href: '#', current: false },
- { name: 'Logs', href: '#', current: false },
+ { name: 'Kustomizations', href: '#', count: 10 },
+ { name: 'Sources', href: '#', count: '5'},
+ { name: 'Runtime', href: '#' },
+ { name: 'Logs', href: '#' },
]
-
- const [navigation, setNavigation] = useState(navigationDefault);
-
- const navigate = (selected) => {
- const nextNavigation = navigation.map((n) => {
- if (n.name === selected) {
- return {...n, current: true};
- } else {
- return {...n, current: false};
- }
- });
- setNavigation(nextNavigation)
- }
-
+
+ const [selected, setSelected] = useState('Kustomizations');
+
+ const handlerSelect = useCallback((selectedNav) => {
+ setSelected(selectedNav);
+ },
+ [setSelected]
+ )
+
+
return (
-
-
-
+
+
+
setExpanded(!expanded)} />
+
-
-
+ {expanded &&
+
+
+
-
-
- { navigation.find((n) => n.name === "Kustomizations").current &&
-
- }
- { navigation.find((n) => n.name === "Sources").current &&
-
- }
+
+
+
+ { selected === "Kustomizations" &&
+
+ }
+ { selected === "Sources" &&
+
+ }
-
-
- )
-}
-
-function CollapsedFooter(props) {
- const { fluxState, setExpanded } = props;
-
- return (
-
setExpanded(true)}
- >
+ }
)
-}
+})
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
}
function SideBar(props) {
+
+ const { navigation, selectedMenu, selected } = props;
+
return (
- )
-}
+ );
+};
export default Footer;