From d610ccb2a3f1521e1436b9e44f25f82bb256aaa4 Mon Sep 17 00:00:00 2001 From: hfcRed Date: Thu, 25 Dec 2025 22:31:26 +0100 Subject: [PATCH] Improve tabs --- app/components/elements/Tabs.module.css | 26 +++++++++++----- app/components/elements/Tabs.tsx | 36 +++++++++++------------ app/features/sendouq/routes/q.looking.tsx | 2 +- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/app/components/elements/Tabs.module.css b/app/components/elements/Tabs.module.css index bb88b0445..f3b40e742 100644 --- a/app/components/elements/Tabs.module.css +++ b/app/components/elements/Tabs.module.css @@ -1,8 +1,14 @@ +.tabListContainer { + overflow-x: auto; + overflow-y: hidden; + padding-bottom: var(--s-1); +} + .tabList { display: flex; flex-direction: row; border-bottom: 2px solid var(--color-border); - overflow-x: visible; + min-width: fit-content; } .tabList svg { @@ -22,14 +28,19 @@ padding-block-start: var(--s-4); } -.disappearing:has(.tabList .tabButton:only-child).padded .tabPanel { +.disappearing:has(.tabList > div:only-child).padded .tabPanel { padding-top: 0; } -.disappearing .tabList:has(.tabButton:only-child) { +.disappearing .tabList:has(> div:only-child) { display: none; } +.tabContainer { + min-width: fit-content; + margin-bottom: -2px; +} + .tabButton { background-color: transparent; border: none; @@ -40,21 +51,20 @@ white-space: nowrap; flex: 1; transform: none !important; - margin-bottom: -2px; } -.tabButton[data-selected] { +.tabContainer[data-selected] .tabButton { border-color: var(--color-text-accent); color: var(--color-text); } -.tabButton[data-focus-visible] { - color: var(--color-accent) !important; +.tabContainer[data-focus-visible] .tabButton { + color: var(--color-text-accent) !important; outline: none; } .tabNumber { - color: var(--color-accent); + color: var(--color-text-accent); margin-inline-start: var(--s-2); } diff --git a/app/components/elements/Tabs.tsx b/app/components/elements/Tabs.tsx index bbf8a7eed..76e60b6cc 100644 --- a/app/components/elements/Tabs.tsx +++ b/app/components/elements/Tabs.tsx @@ -73,37 +73,37 @@ interface SendouTabProps extends TabProps { export function SendouTab({ icon, children, number, ...rest }: SendouTabProps) { return ( - - {icon} - {children} - {typeof number === "number" && number !== 0 && ( - {number} - )} + +
+ {icon} + {children} + {typeof number === "number" && number !== 0 && ( + {number} + )} +
); } interface SendouTabListProps extends TabListProps { - /** Should overflow-x: auto CSS rule be applied? Defaults to true */ - scrolling?: boolean; sticky?: boolean; } export function SendouTabList({ - scrolling = true, sticky, ...rest }: SendouTabListProps) { return ( - +
+ +
); } diff --git a/app/features/sendouq/routes/q.looking.tsx b/app/features/sendouq/routes/q.looking.tsx index f0b7ac820..766ef325c 100644 --- a/app/features/sendouq/routes/q.looking.tsx +++ b/app/features/sendouq/routes/q.looking.tsx @@ -342,7 +342,7 @@ function Groups() { ) : null}
- + {t("q:looking.columns.groups")}