diff --git a/src/renderer/components/shared/tab-nav-bar.component.tsx b/src/renderer/components/shared/tab-nav-bar.component.tsx index 117f8d06..d2ccd337 100644 --- a/src/renderer/components/shared/tab-nav-bar.component.tsx +++ b/src/renderer/components/shared/tab-nav-bar.component.tsx @@ -1,12 +1,10 @@ -import { useEffect, useRef, useState } from "react"; +import { useState } from "react"; import { useThemeColor } from "renderer/hooks/use-theme-color.hook"; import { useTranslation } from "renderer/hooks/use-translation.hook"; export function TabNavBar(props: {tabsText: string[], onTabChange: Function, className?: string}) { const [currentTabIndex, setCurrentTabIndex] = useState(0); - const tabsWrapper = useRef(null); - const [tabsWidth, setTabsWidth] = useState(0); const t = useTranslation(); const secondColor = useThemeColor("second-color"); @@ -16,24 +14,17 @@ export function TabNavBar(props: {tabsText: string[], onTabChange: Function, cla props.onTabChange(newIndex); } - useEffect(() => { - setTimeout(() => { if(tabsWrapper?.current?.children?.length){ setTabsWidth(tabsWrapper.current.children[0].clientWidth);} }, 20) //Ugly but only that works well ¯\_(ツ)_/¯ - }, [props.tabsText]) - - - return ( -
-
- - - + return ( +
+
+ + +
+
+ { props.tabsText.map((y, index) => + selectYear(y)}>{t(y)} + )} +
-
- { props.tabsText.map((y, index) => - selectYear(y)}>{t(y)} - )} -
- -
) }