diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-10-05 13:21:31 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-10-05 13:21:31 +0200 |
| commit | 0564611c8e77e0f5791a3f4854bb456a8717e86a (patch) | |
| tree | 5f6f65a3837c2c37f984b7f3cfa5425351ff6752 /src/components/input_placeholder.rs | |
| parent | feat(buy): Add the framework for the /buy page (diff) | |
| download | web-client-0564611c8e77e0f5791a3f4854bb456a8717e86a.zip | |
feat(form): Provide basic form framework
Diffstat (limited to 'src/components/input_placeholder.rs')
| -rw-r--r-- | src/components/input_placeholder.rs | 11 |
1 files changed, 9 insertions, 2 deletions
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<Input>, #[prop(default = None)] initial_value: Option<String>, ) -> impl IntoView { - let id = Uuid::new_v4(); + let id = get_id(); view! { <div class="relative h-14"> |
