-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(date): add examples for calendar and datepicker
- Loading branch information
1 parent
a803664
commit 41c4b87
Showing
8 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
html!{ | ||
<> | ||
<CalendarView date={*date} {onchange} weekday_start={Weekday::Sun} /> | ||
<p>{date.to_string()}</p> | ||
</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
html!{ | ||
<> | ||
<CalendarView | ||
date={NaiveDate::from_ymd_opt(2023, 9, 20).unwrap()} | ||
rangestart={NaiveDate::from_ymd_opt(2023, 9, 8).unwrap()} | ||
/> | ||
</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::{example, example::ExamplePage}; | ||
use patternfly_yew::prelude::*; | ||
use yew::prelude::*; | ||
use chrono::*; | ||
|
||
#[function_component(CalendarExample)] | ||
pub fn datepicker_example() -> yew::Html { | ||
let date = use_state(|| NaiveDate::from_ymd_opt(2011, 1, 14).unwrap()); | ||
let onchange = { | ||
let date = date.clone(); | ||
Callback::from(move |d| date.set(d)) | ||
}; | ||
|
||
let select_date = example! ("Selectable date" => "calendar.1.example"); | ||
let range = example! ("Date range" => "calendar.2.example"); | ||
|
||
html! { | ||
<> | ||
<ExamplePage title="Calendar month"> | ||
{ select_date } | ||
{ range } | ||
</ExamplePage> | ||
</> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
html!{ | ||
<> | ||
<DatePicker /> | ||
</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::{example, example::ExamplePage}; | ||
use patternfly_yew::prelude::*; | ||
use yew::prelude::*; | ||
use chrono::*; | ||
|
||
#[function_component(DatePickerExample)] | ||
pub fn datepicker_example() -> yew::Html { | ||
let date = example! ("Basic" => "date.1.example"); | ||
|
||
html! { | ||
<> | ||
<ExamplePage title="DatePicker"> | ||
{ date } | ||
</ExamplePage> | ||
</> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod date; | ||
mod calendar; | ||
|
||
pub use date::*; | ||
pub use calendar::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters