Skip to content

Commit 9e8eb95

Browse files
committed
refactor(components): migrate from #[function_component] to #[component] for yew 0.22 compatibility
1 parent 3b281d2 commit 9e8eb95

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/components/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub enum AnalysisState {
1818
Error(String),
1919
}
2020

21-
#[function_component(App)]
21+
#[component(App)]
2222
pub fn app() -> Html {
2323
let state = use_state(|| AnalysisState::Idle);
2424
let token = use_state(|| Option::<String>::None);

src/components/footer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use yew::prelude::*;
22

3-
#[function_component(Footer)]
3+
#[component(Footer)]
44
pub fn footer() -> Html {
55
html! {
66
<footer class="footer">

src/components/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use yew::prelude::*;
22

3-
#[function_component(Header)]
3+
#[component(Header)]
44
pub fn header() -> Html {
55
html! {
66
<header class="header">

src/components/results.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct ResultsProps {
1010
pub on_reset: Callback<()>,
1111
}
1212

13-
#[function_component(Results)]
13+
#[component(Results)]
1414
pub fn results(props: &ResultsProps) -> Html {
1515
let report = &props.report;
1616

@@ -64,7 +64,7 @@ struct CategoryCardProps {
6464
category: CategoryScore,
6565
}
6666

67-
#[function_component(CategoryCard)]
67+
#[component(CategoryCard)]
6868
fn category_card(props: &CategoryCardProps) -> Html {
6969
let cat = &props.category;
7070
let expanded = use_state(|| true);
@@ -128,7 +128,7 @@ struct CheckRowProps {
128128
result: CheckResult,
129129
}
130130

131-
#[function_component(CheckRow)]
131+
#[component(CheckRow)]
132132
fn check_row(props: &CheckRowProps) -> Html {
133133
let r = &props.result;
134134
let show_detail = use_state(|| false);

src/components/score_gauge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub struct ScoreGaugeProps {
66
pub total: u32,
77
}
88

9-
#[function_component(ScoreGauge)]
9+
#[component(ScoreGauge)]
1010
pub fn score_gauge(props: &ScoreGaugeProps) -> Html {
1111
let percentage = if props.total > 0 {
1212
((props.passed as f64 / props.total as f64) * 100.0).round() as u32

src/components/search_bar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct SearchBarProps {
77
pub is_loading: bool,
88
}
99

10-
#[function_component(SearchBar)]
10+
#[component(SearchBar)]
1111
pub fn search_bar(props: &SearchBarProps) -> Html {
1212
let url_ref = use_node_ref();
1313
let token_ref = use_node_ref();

0 commit comments

Comments
 (0)