1- import React , { useRef , useState } from "react" ;
1+ import React , { useRef } from "react" ;
22import { useClickAway } from "react-use" ;
33import { Tabs } from "@kleros/ui-components-library" ;
44import 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)))]" ;
2626const landscapeWidthCalc = "lg:w-[calc(300px+(424-300)*((100vw-300px)/(1250-300)))]" ;
2727
2828const 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