aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-07-22 23:01:10 -0500
committerJP Dillingham <jp@dillingham.me>2023-07-22 23:01:10 -0500
commit2ff09498b33c7b2e0d8318cc85e09da5025e0024 (patch)
tree7cc80847f234aa1ba2a6b896c23603a2ec1304fd /src
parentcd2c5889754728410b3e11e55a37a169cc475993 (diff)
downloadslskd-2ff09498b33c7b2e0d8318cc85e09da5025e0024.tar.gz
track active tab
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/System/Files/index.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/web/src/components/System/Files/index.js b/src/web/src/components/System/Files/index.js
index b5ab465b..07e91a96 100644
--- a/src/web/src/components/System/Files/index.js
+++ b/src/web/src/components/System/Files/index.js
@@ -1,26 +1,34 @@
-import React from 'react';
+import React, { useState } from 'react';
import { Tab } from 'semantic-ui-react';
+import './Files.css';
import Explorer from './Explorer';
const Files = () => {
+ const [tab, setTab] = useState('downloads');
+
const panes = [
{
route: 'downloads',
menuItem: 'Downloads',
- render: () => <Tab.Pane><Explorer root={'downloads'}/></Tab.Pane>,
+ render: () => <Tab.Pane><Explorer root={'downloads'} isActive={tab === 'incomplete'}/></Tab.Pane>,
},
{
route: 'incomplete',
menuItem: 'Incomplete',
- render: () => <Tab.Pane><Explorer root={'incomplete'}/></Tab.Pane>,
+ render: () => <Tab.Pane><Explorer root={'incomplete'} isActive={tab === 'incomplete'}/></Tab.Pane>,
},
];
+ const onTabChange = (e, { activeIndex }) => {
+ setTab(panes[activeIndex].route);
+ };
+
return (
<div>
<Tab
panes={panes}
+ onTabChange={onTabChange}
/>
</div>
);