Skip to content

Commit

Permalink
chore: handle required attribute for the textfield and use in the pub…
Browse files Browse the repository at this point in the history
…lisher component
  • Loading branch information
Michael-Liendo committed Sep 24, 2024
1 parent 21f3383 commit f829d0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/web/src/components/publisher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn Publisher() -> impl IntoView {
send_post_action.dispatch((title, content));
}>
<div class="w-full h-12">
<TextField class="w-full" name="title" value=text_title placeholder="Title" />
<TextField class="w-full" name="title" value=text_title placeholder="Title" required=true />
</div>
<div class="w-full h-12">
<TextField class="w-full" name="content" value=text_content placeholder="Content" />
Expand Down
2 changes: 2 additions & 0 deletions crates/web/src/components/text_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub fn TextField(
#[prop(optional, into)] class: TextProp,
#[prop(optional, into)] variant: MaybeProp<TextFieldVariant>,
#[prop(optional, into)] r#type: TextFieldType,
#[prop(optional, into)] required: MaybeProp<bool>,
#[prop(optional, into)] disabled: MaybeProp<bool>,
#[prop(optional, into)] full_width: MaybeProp<bool>,
) -> impl IntoView {
Expand Down Expand Up @@ -103,6 +104,7 @@ pub fn TextField(
placeholder=placeholder
class=class_names
disabled=disabled
required=required
on:change=handle_change
on:input=handle_input
/>
Expand Down

0 comments on commit f829d0c

Please sign in to comment.