Add real time messaging
This commit is contained in:
parent
0163eab540
commit
9153ba841d
61 changed files with 882 additions and 230 deletions
|
|
@ -1,13 +1,31 @@
|
|||
import type { Component } from "solid-js";
|
||||
import { IMessageBarProps } from "./types";
|
||||
|
||||
const MessageBar: Component<IMessageBarProps> = (props: IMessageBarProps) => {
|
||||
const handleEnter = (e: KeyboardEvent) => {
|
||||
if (e.key === "Enter") {
|
||||
props.onSend?.();
|
||||
}
|
||||
};
|
||||
|
||||
const MessageBar: Component = () => {
|
||||
return (
|
||||
<div class="absolute w-full bottom-0 p-4 z-10">
|
||||
<div class="bg-stone-800/25 backdrop-blur-lg h-16 shadow-bar p-2 flex flex-row gap-2 rounded-full">
|
||||
<label class="bg-stone-800/50 backdrop-blur-lg input w-full h-full rounded-full focus:border-none outline-none">
|
||||
<input type="text" placeholder="Send a message..." />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Send a message..."
|
||||
value={props.text}
|
||||
onInput={(e) =>
|
||||
props.onChangeText?.(e.currentTarget.value)
|
||||
}
|
||||
onKeyDown={handleEnter}
|
||||
/>
|
||||
</label>
|
||||
<button class="bg-stone-950/50 backdrop-blur-lg btn btn-neutral h-full rounded-full">
|
||||
<button
|
||||
class="bg-stone-950/50 backdrop-blur-lg btn btn-neutral h-full rounded-full"
|
||||
onClick={props.onSend}
|
||||
>
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
export * from "./MessageBar";
|
||||
export * from "./types";
|
||||
|
|
|
|||
7
src/components/MessageBar/types.ts
Normal file
7
src/components/MessageBar/types.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
interface IMessageBarProps {
|
||||
text: string;
|
||||
onChangeText?: (text: string) => void;
|
||||
onSend?: () => void;
|
||||
}
|
||||
|
||||
export { type IMessageBarProps };
|
||||
Loading…
Add table
Add a link
Reference in a new issue