Skip to main content

LMConversationSearch

LMConversationSearch renders the conversation search for the current chatroom. Similar to LMChatroomSearch, it also accepts a prop onCloseSearch calling which will hide the UI.

Props

PropertyTypeDescriptionOptional
onCloseSearchZeroArgVoidReturnsFunction to close the search screen.

CSS Classnames

ClassnameDescription
lm-conversation-searchMain container for conversation search
lm-conversation-search-go-back-iconBack button icon
lm-cursor-pointerElement with pointer cursor
lm-conversation-search-inputSearch input container
lm-conversation-search-input-fieldSearch input text field
lm-conversation-search-listList of search results
lm-conversation-search-list-item lm-cursor-pointerClickable search result item
search-conversation-member-iconMember avatar in search results
search-conversation-contentContent container for search results
search-conversation-user-metaUser metadata in search results
search-conversation-messageMessage preview in search results

Example

To customise the component with their classnames, Open your base css file and override the styles using the classname

.search-conversation-content {
font-size: 18px;
color: "red";
}

Advanced Customisation

Hooks Used

Contexts Used

You can also pass your own custom view for LMConversationSearch where you can tweak with the logic and UI for this component.

Below is an example for customising the view for LMConversationSearch and rendering your own view. It is fairly a 2 simple step process.

  • First you create your own custom component using the hooks and contexts made available by LikeMinds. The will be responsible for fetching data, you might want to process. For example you can get chatroom list by using the hook useDMChannelLists.

  • Then you just have to pass it as a prop to LMClientOverlayProvider.

  • Step 1: Create your own custom view.

import {
LMClientOverlayProvider,
LMChannel,
initiateLMClient,
LMChatTheme,
useConversationSearch
} from "@likeminds.community/likeminds-chat-reactjs";

// Custom Component for Conversation Search
const CustomConversationSearch = () => {
const {
searchList,
searchConversations,
loadMoreConversations,
onSearchedConversationClick,
searchKey,
setSearchKey,
} = useConversationSearch();
return (
// Your Custom Code to sender views for Conversation search
);
};

  • Step 2: Pass your Custom View to LMClientOverlayProvider
import {
LMClientOverlayProvider,
LMChannel,
initiateLMClient,
LMChatTheme,
useConversationSearch
} from "@likeminds.community/likeminds-chat-reactjs";

// Custom Component for ConversationSearch
const CustomConversationSearch = () => {
const {
searchList,
searchConversations,
loadMoreConversations,
onSearchedConversationClick,
searchKey,
setSearchKey,
} = useConversationSearch();
return (
// Your Custom Code to sender views for Conversation search
);

const App = () => {
const lmChatClient = initiateLMClient();
return (
<LMClientOverlayProvider
client={lmChatClient}
userDetails={userDetails}
lmChatTheme={LMChatTheme.COMMUNITY_CHAT}
customComponents={{
searchConversation: <CustomConversationSearch />,
}}
>
<LMChannel />
</LMClientOverlayProvider>
);
};
export default App;

Reference

For reference checkout this file