mirror of
https://github.com/kristoferssolo/cipher-workshop.git
synced 2025-12-31 13:52:29 +00:00
feat(web): add prefix hints
This commit is contained in:
parent
63271c50f8
commit
02ab1d119c
@ -190,11 +190,13 @@ fn clean_hex_input(input: String) -> String {
|
|||||||
fn KeyInput(set_key_input: WriteSignal<String>) -> impl IntoView {
|
fn KeyInput(set_key_input: WriteSignal<String>) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<div class="lable-header">
|
||||||
<label>"Secret Key"</label>
|
<label>"Secret Key"</label>
|
||||||
|
<span class="input-hint">"Prefix: 0x (Hex), 0b (Bin), or nothing (Text)"</span>
|
||||||
|
</div>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
prop:key_input
|
placeholder="Enter key (e.g., 0x1A2B...)"
|
||||||
placeholder="Enter key..."
|
|
||||||
on:input=move |ev| set_key_input(event_target_value(&ev))
|
on:input=move |ev| set_key_input(event_target_value(&ev))
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -219,22 +221,19 @@ fn TextInput(
|
|||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>
|
|
||||||
{move || {
|
|
||||||
match mode.get() {
|
|
||||||
OperationMode::Encrypt => "Plaintext Input",
|
|
||||||
OperationMode::Decrypt => "Ciphertext (Hex) Input",
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
</label>
|
|
||||||
{move || {
|
{move || {
|
||||||
match mode.get() {
|
match mode.get() {
|
||||||
OperationMode::Encrypt => {
|
OperationMode::Encrypt => {
|
||||||
view! {
|
view! {
|
||||||
|
<div class="lable-header">
|
||||||
|
<label>"Plaintext Input"</label>
|
||||||
|
<span class="input-hint">
|
||||||
|
"Prefix: 0x (Hex), 0b (Bin), or nothing (Text)"
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="input-wrapper standard-input">
|
<div class="input-wrapper standard-input">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
prop:value=move || text_input.get()
|
|
||||||
placeholder="Enter text..."
|
placeholder="Enter text..."
|
||||||
on:input=handle_text_input
|
on:input=handle_text_input
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@ -245,6 +244,9 @@ fn TextInput(
|
|||||||
}
|
}
|
||||||
OperationMode::Decrypt => {
|
OperationMode::Decrypt => {
|
||||||
view! {
|
view! {
|
||||||
|
<div class="lable-header">
|
||||||
|
<label>"Ciphertext Input"</label>
|
||||||
|
</div>
|
||||||
<div class="input-wrapper hex-input">
|
<div class="input-wrapper hex-input">
|
||||||
<span class="prefix">"0x"</span>
|
<span class="prefix">"0x"</span>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@ -651,3 +651,23 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-hint {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
opacity: 0.7;
|
||||||
|
font-family: "Inter", "Segoe UI", sans-serif;
|
||||||
|
text-transform: none;
|
||||||
|
letter-spacing: normal;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user