diff --git a/web/chat/chat-tabs.css b/web/chat/chat-tabs.css --- a/web/chat/chat-tabs.css +++ b/web/chat/chat-tabs.css @@ -9,18 +9,9 @@ flex-direction: column; } -div.tabs { - display: flex; - flex-direction: row; - color: var(--fg); - background: var(--bg); -} - div.tabItem { display: flex; justify-content: center; - width: 50%; - padding: 16px 0; text-align: center; cursor: pointer; } @@ -30,16 +21,6 @@ div.tabItem span svg { padding-right: 12px; } -div.tabItemActive { - border: outset var(--thread-selection); - border-width: 0 0 3px 0; -} -div.tabItemInactive { - background-color: var(--bg); - color: var(--color-disabled); - border: 2px solid var(--border-color); - border-width: 0 0 3px 0; -} div.threadList { flex: 1; diff --git a/web/chat/chat-tabs.react.js b/web/chat/chat-tabs.react.js --- a/web/chat/chat-tabs.react.js +++ b/web/chat/chat-tabs.react.js @@ -5,6 +5,7 @@ import { unreadBackgroundCount } from 'lib/selectors/thread-selectors'; +import Tabs from '../components/tabs.react'; import { useSelector } from '../redux/redux-utils'; import css from './chat-tabs.css'; import ChatThreadList from './chat-thread-list.react'; @@ -24,33 +25,45 @@ ); const { activeTab, setActiveTab } = threadListContext; - const onClickHome = React.useCallback(() => setActiveTab('Focus'), [ - setActiveTab, - ]); - const onClickBackground = React.useCallback( - () => setActiveTab('Background'), + const setActiveChatTab = React.useCallback( + (newTab: string) => { + invariant( + newTab === 'Background' || newTab === 'Focus', + 'newTab must be Background or Focus', + ); + setActiveTab(newTab); + }, [setActiveTab], ); - return ( -
-
- - -
+ const chatThreadList = React.useMemo( + () => (
+ ), + [], + ); + + const tabs = React.useMemo( + () => [ + { + id: 'Focus', + header: , + content: chatThreadList, + }, + { + id: 'Background', + header: , + content: chatThreadList, + }, + ], + [backgroundTitle, chatThreadList], + ); + + return ( +
+
); } diff --git a/web/chat/chat-thread-tab.react.js b/web/chat/chat-thread-tab.react.js --- a/web/chat/chat-thread-tab.react.js +++ b/web/chat/chat-thread-tab.react.js @@ -1,6 +1,5 @@ // @flow -import classNames from 'classnames'; import * as React from 'react'; import SWMansionIcon, { type Icon } from '../SWMansionIcon.react'; @@ -8,19 +7,13 @@ type Props = { +title: string, - +onClick: (title: string) => void, - +tabIsActive: boolean, +icon: Icon, }; function ChatThreadTab(props: Props): React.Node { - const { title, onClick, tabIsActive, icon } = props; - const className = classNames({ - [css.tabItem]: true, - [css.tabItemActive]: tabIsActive, - [css.tabItemInactive]: !tabIsActive, - }); + const { title, icon } = props; + return ( -
+
{title}