diff --git a/web/src/components/config_section.rs b/web/src/components/config_section.rs index b628480..9aee874 100644 --- a/web/src/components/config_section.rs +++ b/web/src/components/config_section.rs @@ -1,4 +1,3 @@ -use crate::components::radio_button::RadioButton; use cipher_factory::prelude::*; use leptos::{prelude::*, tachys::dom::event_target_value}; use std::str::FromStr; @@ -11,7 +10,7 @@ pub fn ConfigurationSection( set_mode: WriteSignal, output_fmt: ReadSignal, update_output: impl Fn(OutputFormat) + Copy + Send + 'static, -) -> AnyView { +) -> impl IntoView { let handle_format_change = move |ev| { let val = event_target_value(&ev); let fmt = OutputFormat::from_str(&val).unwrap_or_default(); @@ -39,39 +38,49 @@ pub fn ConfigurationSection( view! {
- +
-
- - +
+ +
{move || { if mode.get() != OperationMode::Decrypt { return view! { }.into_any(); } view! { -
-
- - -
+
+ +
} .into_any() }}
- }.into_any() + } } diff --git a/web/src/components/mod.rs b/web/src/components/mod.rs index c3b1bbb..3a2dbe7 100644 --- a/web/src/components/mod.rs +++ b/web/src/components/mod.rs @@ -6,5 +6,4 @@ pub mod file_input; pub mod iv_input; pub mod key_input; pub mod output_box; -pub mod radio_button; pub mod text_input; diff --git a/web/src/components/radio_button.rs b/web/src/components/radio_button.rs deleted file mode 100644 index 318d313..0000000 --- a/web/src/components/radio_button.rs +++ /dev/null @@ -1,25 +0,0 @@ -use cipher_factory::prelude::OperationMode; -use leptos::prelude::*; - -#[component] -pub fn RadioButton( - value: OperationMode, - current: ReadSignal, - set_current: WriteSignal, -) -> AnyView { - view! { -
- -
- } - .into_any() -} diff --git a/web/style/main.scss b/web/style/main.scss index c9b17cf..6a09d8e 100644 --- a/web/style/main.scss +++ b/web/style/main.scss @@ -701,11 +701,13 @@ main { } } -// Input mode toggle (Text/File switcher) +// Mode toggle buttons (shared style for encrypt/decrypt and text/file) +.mode-toggle, .input-mode-toggle { display: flex; gap: 4px; background: var(--bg-input); + border: 1px solid var(--border); border-radius: 6px; padding: 2px; @@ -713,10 +715,10 @@ main { background: transparent; border: none; color: var(--text-muted); - padding: 4px 12px; + padding: 6px 14px; border-radius: 4px; cursor: pointer; - font-size: 0.8rem; + font-size: 0.85rem; font-weight: 600; transition: all 0.2s; @@ -731,6 +733,41 @@ main { } } +// Format selector (appears next to mode toggle in decrypt mode) +.format-select { + display: flex; + align-items: center; + gap: 8px; + background: var(--bg-input); + border: 1px solid var(--border); + border-radius: 6px; + padding: 2px 10px; + animation: fadeIn 0.2s ease-in-out; + + label { + margin: 0; + color: var(--text-muted); + font-weight: 500; + font-size: 0.85rem; + text-transform: none; + letter-spacing: normal; + } + + select { + background: var(--bg-body); + border: none; + border-radius: 4px; + color: var(--text-main); + padding: 6px 8px; + font-size: 0.85rem; + cursor: pointer; + + &:focus { + outline: none; + } + } +} + // Textarea wrapper .textarea-wrapper { position: relative;