Skip to content

Commit

Permalink
feat: base of textField component
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Liendo committed Jun 15, 2024
1 parent 8ab58eb commit d0fe057
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/web/src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod helper;

pub mod button;
pub mod text_field;
16 changes: 16 additions & 0 deletions crates/web/src/components/text_field.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use leptos::{component, view, IntoView};

#[component]
pub fn TextField(
#[prop(optional, into)] name: String,
#[prop(optional, into)] id: String,
#[prop(optional, into)] placeholder: String,
#[prop(optional, into)] value: String,
#[prop(optional, into, default = "text".to_string())] r#type: String,
) -> impl IntoView {
view! {
<>
<input type=r#type name=name value=value id=id placeholder=placeholder class="p-5 w-full font-semibold text-black bg-black rounded" />
<>
}
}
2 changes: 2 additions & 0 deletions crates/web/src/views/home.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::components::text_field::TextField;
use leptos::{component, view, IntoView};

use crate::components::button::{Button, ButtonVariant};
Expand All @@ -11,6 +12,7 @@ pub fn Home() -> impl IntoView {
<Button variant={ButtonVariant::Text}>{"Text"}</Button>
<Button variant={ButtonVariant::Contained}>{"Contained"}</Button>
<Button variant={ButtonVariant::Outlined}>{"Outlined"}</Button>
<TextField placeholder="hola" />
</section>
}
}

0 comments on commit d0fe057

Please sign in to comment.