Changeset View
Changeset View
Standalone View
Standalone View
web/modals/chat/sidebar-list-modal.react.js
// @flow | // @flow | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { useSearchSidebars } from 'lib/hooks/search-sidebars'; | import { useSearchSidebars } from 'lib/hooks/search-sidebars'; | ||||
import type { ThreadInfo } from 'lib/types/thread-types'; | import type { ThreadInfo } from 'lib/types/thread-types'; | ||||
import SidebarItem from '../../chat/sidebar-item.react'; | import css from '../../chat/sidebar-modal-item.css'; | ||||
import SideBarModalItem from '../../chat/sidebar-modal-item.react'; | |||||
import { useModalContext } from '../modal-provider.react'; | import { useModalContext } from '../modal-provider.react'; | ||||
import SearchModal from '../search-modal.react'; | import SearchModal from '../search-modal.react'; | ||||
type Props = { | type Props = { | ||||
+threadInfo: ThreadInfo, | +threadInfo: ThreadInfo, | ||||
}; | }; | ||||
type SidebarModalContentProps = { | type SidebarModalContentProps = { | ||||
+threadInfo: ThreadInfo, | +threadInfo: ThreadInfo, | ||||
+onClose: () => void, | +onClose: () => void, | ||||
+searchText: string, | +searchText: string, | ||||
}; | }; | ||||
function SidebarModalContent(props: SidebarModalContentProps): React.Node { | function SidebarModalContent(props: SidebarModalContentProps): React.Node { | ||||
const { threadInfo, searchText } = props; | const { threadInfo, searchText } = props; | ||||
const { popModal } = useModalContext(); | const { popModal } = useModalContext(); | ||||
const { sidebars } = useSearchSidebars(threadInfo, searchText); | const { sidebars } = useSearchSidebars(threadInfo, searchText); | ||||
return ( | return ( | ||||
<ul> | <ul className={css.sidebarList}> | ||||
{sidebars.map(sideBar => ( | {sidebars.map(sideBar => ( | ||||
<li key={sideBar.threadInfo.id} onClick={popModal}> | <li key={sideBar.threadInfo.id} onClick={popModal}> | ||||
<SidebarItem sidebarInfo={sideBar} /> | <SideBarModalItem sidebar={sideBar} /> | ||||
</li> | </li> | ||||
))} | ))} | ||||
</ul> | </ul> | ||||
); | ); | ||||
} | } | ||||
function SidebarListModal(props: Props): React.Node { | function SidebarListModal(props: Props): React.Node { | ||||
const { popModal } = useModalContext(); | const { popModal } = useModalContext(); | ||||
Show All 26 Lines |