From 9a2b7908979b88e4792ed7e55880d1e8a1325b72 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Wed, 11 Feb 2026 14:10:35 -0500 Subject: [PATCH] for consistency --- src/components/Selectable.tsx | 41 ++++++++++++++++++++++++++++++++ src/components/TabNavigation.tsx | 21 +++++++--------- 2 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 src/components/Selectable.tsx diff --git a/src/components/Selectable.tsx b/src/components/Selectable.tsx new file mode 100644 index 0000000..77436e7 --- /dev/null +++ b/src/components/Selectable.tsx @@ -0,0 +1,41 @@ +import { useTheme } from "@/context/ThemeContext"; +import type { JSXElement } from "solid-js"; +import type { BoxOptions, TextOptions } from "@opentui/core"; + +export function SelectableBox({ + selected, + children, + ...props +}: { + selected: () => boolean; + children: JSXElement; +} & BoxOptions) { + const { theme } = useTheme(); + + return ( + + {children} + + ); +} + +export function SelectableText({ + selected, + children, + ...props +}: { + selected: () => boolean; + children: JSXElement; +} & TextOptions) { + const { theme } = useTheme(); + + return ( + + {children} + + ); +} diff --git a/src/components/TabNavigation.tsx b/src/components/TabNavigation.tsx index 91e7358..d8573eb 100644 --- a/src/components/TabNavigation.tsx +++ b/src/components/TabNavigation.tsx @@ -1,6 +1,7 @@ import { useTheme } from "@/context/ThemeContext"; import { TABS } from "@/utils/navigation"; import { For } from "solid-js"; +import { SelectableBox, SelectableText } from "@/components/Selectable"; interface TabNavigationProps { activeTab: TABS; @@ -29,24 +30,18 @@ export function TabNavigation(props: TabNavigationProps) { > {(tab) => ( - tab.id == props.activeTab} onMouseDown={() => props.onTabSelect(tab.id)} - style={{ - backgroundColor: - tab.id == props.activeTab ? theme.primary : "transparent", - }} > - tab.id == props.activeTab} + alignSelf="center" > {tab.label} - - + + )}