Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,19 @@ web-sys = { version = "0.3", default-features = false, features = [
"DomTokenList",
"DragEvent",
"Element",
"Event",
"EventTarget",
"Headers",
"HtmlElement",
"HtmlInputElement",
"InputEvent",
"KeyboardEvent",
"Location",
"MediaQueryList",
"MouseEvent",
"MutationObserver",
"MutationObserverInit",
"MutationRecord",
"Navigator",
"Node",
"NodeList",
Expand Down
5 changes: 5 additions & 0 deletions app/src/domain/markdown_ui/components/static_demo_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fn transform_code_for_display(code: &str) -> String {
#[component]
pub fn StaticDemoWrapper(demo_type: MarkdownType, children: Children) -> impl IntoView {
let current_tab = RwSignal::new(Tab::default());
let use_embedded_blocks = matches!(demo_type, MarkdownType::StaticDemoInputOtp);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This use_embedded_blocks flag was not part of issue #26 — the issue only asked to replace otp.js with Rust. Modifying StaticDemoWrapper to hardcode a special case for OTP is a smell: it couples a generic wrapper to a specific component, and it will need to be repeated for every future component that wants the same behavior. Please revert the changes to demo_input_otp.rs and static_demo_wrapper.rs and open a separate issue/PR if the demo layout needs improvement.

// Zero-allocation static lookup
let Some(demo_data) = get_static_registry_entry(demo_type) else {
Expand Down Expand Up @@ -60,6 +61,10 @@ pub fn StaticDemoWrapper(demo_type: MarkdownType, children: Children) -> impl In
// Store children at the top level so we can reference it reactively
let children_view = children();

if use_embedded_blocks {
return view! { <div class="w-full">{children_view}</div> }.into_any();
}

view! {
<div class="flex flex-col gap-2 w-full">
<div class="flex justify-between items-center">
Expand Down
Loading