Files
CT/src/View/Components/chatEntry.tsx
T

30 lines
733 B
TypeScript
Raw Normal View History

2024-07-20 13:30:01 +02:00
import "./chatEntry.css";
2024-07-20 05:10:50 +02:00
import * as React from "bloatless-react";
2024-07-20 14:16:26 +02:00
import ChatViewModel from "../../ViewModel/chatViewModel";
2024-07-20 05:10:50 +02:00
2024-07-20 14:16:26 +02:00
export function ChatEntry(chatViewModel: ChatViewModel) {
2024-07-20 16:49:01 +02:00
const view = (
2024-07-20 14:16:26 +02:00
<button class="chat-entry tile" on:click={chatViewModel.open}>
<span
class="shadow"
subscribe:innerText={chatViewModel.primaryChannel}
></span>
<h2 subscribe:innerText={chatViewModel.primaryChannel}></h2>
2024-07-20 13:30:01 +02:00
</button>
2024-07-20 05:10:50 +02:00
);
2024-07-20 16:49:01 +02:00
chatViewModel.index.subscribe((newIndex) => {
view.style.order = newIndex;
});
return view;
2024-07-20 05:10:50 +02:00
}
2024-07-20 14:16:26 +02:00
export const ChatViewModelToChatEntry: React.StateItemConverter<
ChatViewModel
> = (chatViewModel: ChatViewModel) => {
return ChatEntry(chatViewModel);
2024-07-20 05:10:50 +02:00
};