wip: rename fc to component

This commit is contained in:
Jonathan Kelley committed 2021-12-09 21:19:31 -05:00
1 parent 85ab8b91c6
commit 1e4a599d14
61 files changed
+524 -145

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ fn test_borrowed_state() {
let _ = VirtualDom::new(Parent);
}
fn Parent(cx: Context, props: &()) -> Element {
fn Parent(cx: Context, _props: &()) -> Element {
let value = cx.use_hook(|_| String::new(), |f| &*f);
cx.render(rsx! {
+8 -8
View File
@@ -1,4 +1,4 @@
#![allow(unused, non_upper_case_globals)]
#![allow(unused, non_upper_case_globals, non_snake_case)]
//! Prove that the dom works normally through virtualdom methods.
//!
@@ -13,7 +13,7 @@ use dioxus_html as dioxus_elements;
mod test_logging;
use DomEdit::*;
fn new_dom<P: 'static + Send>(app: FC<P>, props: P) -> VirtualDom {
fn new_dom<P: 'static + Send>(app: Component<P>, props: P) -> VirtualDom {
const IS_LOGGING_ENABLED: bool = false;
test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new_with_props(app, props)
@@ -21,7 +21,7 @@ fn new_dom<P: 'static + Send>(app: FC<P>, props: P) -> VirtualDom {
#[test]
fn test_original_diff() {
static APP: FC<()> = |cx, props| {
static APP: Component<()> = |cx, props| {
cx.render(rsx! {
div {
div {
@@ -57,7 +57,7 @@ fn test_original_diff() {
#[test]
fn create() {
static APP: FC<()> = |cx, props| {
static APP: Component<()> = |cx, props| {
cx.render(rsx! {
div {
div {
@@ -120,7 +120,7 @@ fn create() {
#[test]
fn create_list() {
static APP: FC<()> = |cx, props| {
static APP: Component<()> = |cx, props| {
cx.render(rsx! {
{(0..3).map(|f| rsx!{ div {
"hello"
@@ -169,7 +169,7 @@ fn create_list() {
#[test]
fn create_simple() {
static APP: FC<()> = |cx, props| {
static APP: Component<()> = |cx, props| {
cx.render(rsx! {
div {}
div {}
@@ -207,7 +207,7 @@ fn create_simple() {
}
#[test]
fn create_components() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx! {
Child { "abc1" }
Child { "abc2" }
@@ -273,7 +273,7 @@ fn create_components() {
}
#[test]
fn anchors() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx! {
{true.then(|| rsx!{ div { "hello" } })}
{false.then(|| rsx!{ div { "goodbye" } })}
+9 -9
View File
@@ -22,7 +22,7 @@ fn manual_diffing() {
value: Shared<&'static str>,
}
static App: FC<AppProps> = |cx, props| {
static App: Component<AppProps> = |cx, props| {
let val = props.value.lock().unwrap();
cx.render(rsx! { div { "{val}" } })
};
@@ -46,7 +46,7 @@ fn manual_diffing() {
#[test]
fn events_generate() {
static App: FC<()> = |cx, _| {
static App: Component<()> = |cx, _| {
let mut count = use_state(cx, || 0);
let inner = match *count {
@@ -105,7 +105,7 @@ fn events_generate() {
#[test]
fn components_generate() {
static App: FC<()> = |cx, _| {
static App: Component<()> = |cx, _| {
let mut render_phase = use_state(cx, || 0);
render_phase += 1;
@@ -122,7 +122,7 @@ fn components_generate() {
})
};
static Child: FC<()> = |cx, _| {
static Child: Component<()> = |cx, _| {
cx.render(rsx! {
h1 {}
})
@@ -222,7 +222,7 @@ fn components_generate() {
#[test]
fn component_swap() {
// simple_logger::init();
static App: FC<()> = |cx, _| {
static App: Component<()> = |cx, _| {
let mut render_phase = use_state(cx, || 0);
render_phase += 1;
@@ -261,7 +261,7 @@ fn component_swap() {
})
};
static NavBar: FC<()> = |cx, _| {
static NavBar: Component<()> = |cx, _| {
println!("running navbar");
cx.render(rsx! {
h1 {
@@ -271,7 +271,7 @@ fn component_swap() {
})
};
static NavLink: FC<()> = |cx, _| {
static NavLink: Component<()> = |cx, _| {
println!("running navlink");
cx.render(rsx! {
h1 {
@@ -280,7 +280,7 @@ fn component_swap() {
})
};
static Dashboard: FC<()> = |cx, _| {
static Dashboard: Component<()> = |cx, _| {
println!("running dashboard");
cx.render(rsx! {
div {
@@ -289,7 +289,7 @@ fn component_swap() {
})
};
static Results: FC<()> = |cx, _| {
static Results: Component<()> = |cx, _| {
println!("running results");
cx.render(rsx! {
div {
+2 -2
View File
@@ -13,12 +13,12 @@ mod test_logging;
fn shared_state_test() {
struct MySharedState(&'static str);
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.provide_state(MySharedState("world!"));
cx.render(rsx!(Child {}))
};
static Child: FC<()> = |cx, props| {
static Child: Component<()> = |cx, props| {
let shared = cx.consume_state::<MySharedState>()?;
cx.render(rsx!("Hello, {shared.0}"))
};
+6 -6
View File
@@ -19,7 +19,7 @@ use DomEdit::*;
#[test]
fn app_runs() {
static App: FC<()> = |cx, props| rsx!(cx, div{"hello"} );
static App: Component<()> = |cx, props| rsx!(cx, div{"hello"} );
let mut vdom = VirtualDom::new(App);
let edits = vdom.rebuild();
@@ -27,7 +27,7 @@ fn app_runs() {
#[test]
fn fragments_work() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx!(
div{"hello"}
div{"goodbye"}
@@ -41,7 +41,7 @@ fn fragments_work() {
#[test]
fn lists_work() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx!(
h1 {"hello"}
{(0..6).map(|f| rsx!(span{ "{f}" }))}
@@ -54,7 +54,7 @@ fn lists_work() {
#[test]
fn conditional_rendering() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx!(
h1 {"hello"}
{true.then(|| rsx!(span{ "a" }))}
@@ -87,13 +87,13 @@ fn conditional_rendering() {
#[test]
fn child_components() {
static App: FC<()> = |cx, props| {
static App: Component<()> = |cx, props| {
cx.render(rsx!(
{true.then(|| rsx!(Child { }))}
{false.then(|| rsx!(Child { }))}
))
};
static Child: FC<()> = |cx, props| {
static Child: Component<()> = |cx, props| {
cx.render(rsx!(
h1 {"hello"}
h1 {"goodbye"}