From 0564611c8e77e0f5791a3f4854bb456a8717e86a Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 5 Oct 2025 13:21:31 +0200 Subject: feat(form): Provide basic form framework --- src/components/input_placeholder.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/components/input_placeholder.rs') diff --git a/src/components/input_placeholder.rs b/src/components/input_placeholder.rs index 92f9926..05b9509 100644 --- a/src/components/input_placeholder.rs +++ b/src/components/input_placeholder.rs @@ -1,10 +1,17 @@ +use std::sync::atomic::{AtomicU32, Ordering}; + use leptos::{ IntoView, component, html::Input, prelude::{ClassAttribute, ElementChild, GlobalAttributes, NodeRef, NodeRefAttribute}, view, }; -use uuid::Uuid; + +fn get_id() -> u32 { + static ID: AtomicU32 = AtomicU32::new(0); + + ID.fetch_add(1, Ordering::Relaxed) +} #[component] pub fn InputPlaceholder( @@ -13,7 +20,7 @@ pub fn InputPlaceholder( node_ref: NodeRef, #[prop(default = None)] initial_value: Option, ) -> impl IntoView { - let id = Uuid::new_v4(); + let id = get_id(); view! {
-- cgit 1.4.1