Skip to content

Commit 22c50e7

Browse files
committed
refactor: streamline Settings tab management by defaulting to the component library
1 parent 844e3a2 commit 22c50e7

File tree

1 file changed

+5
-10
lines changed
  • web/src/layout/Header/navbar/Menu/Settings

1 file changed

+5
-10
lines changed

web/src/layout/Header/navbar/Menu/Settings/index.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useState } from "react";
1+
import React, { useRef } from "react";
22
import { useClickAway } from "react-use";
33
import { Tabs } from "@kleros/ui-components-library";
44
import General from "./General";
@@ -12,7 +12,7 @@ const TABS = [
1212
id: 0,
1313
value: 0,
1414
text: "General",
15-
content: null,
15+
content: <General />,
1616
},
1717
{
1818
id: 1,
@@ -22,11 +22,10 @@ const TABS = [
2222
},
2323
];
2424

25-
const inlinePaddingCalc = "px-[calc(8px+(32-8)*((100vw-300px)/(1250-300)))]";
25+
const tabListInlinePaddingCalc = "[&>div:first-child]:px-[calc(8px+(32-8)*((100vw-300px)/(1250-300)))]";
2626
const landscapeWidthCalc = "lg:w-[calc(300px+(424-300)*((100vw-300px)/(1250-300)))]";
2727

2828
const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
29-
const [currentTab, setCurrentTab] = useState<number>(0);
3029
const containerRef = useRef(null);
3130
const location = useLocation();
3231
const navigate = useNavigate();
@@ -47,13 +46,9 @@ const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
4746
>
4847
<div className="flex justify-center text-2xl mt-6 text-klerosUIComponentsPrimaryText">Settings</div>
4948
<Tabs
50-
className={cn("py-0 max-w-[660px] w-[86vw]", inlinePaddingCalc, landscapeWidthCalc)}
51-
items={TABS}
52-
callback={(_, value: number) => {
53-
setCurrentTab(value);
54-
}}
49+
className={cn("py-0 max-w-[660px] w-[86vw]", landscapeWidthCalc, tabListInlinePaddingCalc)}
50+
items={[TABS[0], { ...TABS[1], content: <NotificationSettings {...{ toggleIsSettingsOpen }} /> }]}
5551
/>
56-
{currentTab === 0 ? <General /> : <NotificationSettings {...{ toggleIsSettingsOpen }} />}
5752
</div>
5853
);
5954
};

0 commit comments

Comments
 (0)