fix forms
This commit is contained in:
parent
afa265cdfc
commit
cafac264a7
2 changed files with 14 additions and 5 deletions
|
@ -7,7 +7,7 @@ use serde_json::to_string;
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Auth() -> impl IntoView {
|
pub fn Auth() -> impl IntoView {
|
||||||
let websocket = expect_context::<WebSocketContext>();
|
let websocket = expect_context::<WebSocketContext>();
|
||||||
let (username, _set_username) = create_signal("Anonymous");
|
let (username, set_username) = create_signal("Anonymous".to_string());
|
||||||
|
|
||||||
let username_input_ref = create_node_ref::<Input>();
|
let username_input_ref = create_node_ref::<Input>();
|
||||||
let send_login = move |_| {
|
let send_login = move |_| {
|
||||||
|
@ -17,6 +17,8 @@ pub fn Auth() -> impl IntoView {
|
||||||
})
|
})
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
set_username.set(username_input_ref.get().unwrap().value());
|
||||||
|
username_input_ref.get().unwrap().set_value("");
|
||||||
logging::log!("sent");
|
logging::log!("sent");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,18 +26,22 @@ pub fn Auth() -> impl IntoView {
|
||||||
<div class="p-1">
|
<div class="p-1">
|
||||||
<h2 class="text-2xl">Sign in:</h2>
|
<h2 class="text-2xl">Sign in:</h2>
|
||||||
<p>Username:</p>
|
<p>Username:</p>
|
||||||
|
<form
|
||||||
|
onsubmit="return false"
|
||||||
|
on:submit=send_login
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
class="w-96 font-mono rounded-sm bg-slate-900 text-slate-200"
|
class="w-96 font-mono rounded-sm bg-slate-900 text-slate-200"
|
||||||
placeholder=move || username.get()
|
placeholder=move || username.get()
|
||||||
node_ref=username_input_ref
|
node_ref=username_input_ref
|
||||||
on:change=send_login.clone()
|
|
||||||
/>
|
/>
|
||||||
|
<br />
|
||||||
<input
|
<input
|
||||||
class="py-2 px-4 pl-4 font-bold text-white rounded border-b-4 bg-slate-600 border-slate-800 hover:bg-slate-700 hover:border-slate-500"
|
class="py-2 px-4 pl-4 font-bold text-white rounded border-b-4 bg-slate-600 border-slate-800 hover:bg-slate-700 hover:border-slate-500"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Send"
|
value="Send"
|
||||||
on:change=send_login.clone()
|
|
||||||
/>
|
/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,18 +84,21 @@ pub fn Chat() -> impl IntoView {
|
||||||
</textarea>
|
</textarea>
|
||||||
<br/>
|
<br/>
|
||||||
<span>
|
<span>
|
||||||
|
<form
|
||||||
|
onsubmit="return false"
|
||||||
|
on:submit=send_message
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
class="w-80 h-11 font-mono rounded-sm bg-slate-900 text-slate-200"
|
class="w-80 h-11 font-mono rounded-sm bg-slate-900 text-slate-200"
|
||||||
placeholder="talk shit..."
|
placeholder="talk shit..."
|
||||||
node_ref=chat_input_ref
|
node_ref=chat_input_ref
|
||||||
on:change=send_message.clone()
|
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
class="py-2 px-4 pl-4 font-bold text-white rounded border-b-4 bg-slate-600 border-slate-800 hover:bg-slate-700 hover:border-slate-500"
|
class="py-2 px-4 pl-4 font-bold text-white rounded border-b-4 bg-slate-600 border-slate-800 hover:bg-slate-700 hover:border-slate-500"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Send"
|
value="Send"
|
||||||
on:change=send_message.clone()
|
|
||||||
/>
|
/>
|
||||||
|
</form>
|
||||||
</span>
|
</span>
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue