chore: rename ctx to cx

This commit is contained in:
Jonathan Kelley committed 2021-06-25 21:15:33 -04:00
1 parent 23c14078bb
commit 81382e7044
99 files changed
+789 -664

No files matched your search

@@ -2,9 +2,9 @@ use crate::recoil;
use crate::state::{FilterState, TODOS};
use dioxus_core::prelude::*;
pub fn FilterToggles(ctx: Context<()>) -> VNode {
let reducer = recoil::use_callback(&ctx, || ());
let items_left = recoil::use_atom_family(&ctx, &TODOS, uuid::Uuid::new_v4());
pub fn FilterToggles(cx: Context<()>) -> VNode {
let reducer = recoil::use_callback(&cx, || ());
let items_left = recoil::use_atom_family(&cx, &TODOS, uuid::Uuid::new_v4());
let toggles = [
("All", "", FilterState::All),
@@ -27,7 +27,7 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
let item_text = "";
let items_left = "";
ctx.render(rsx! {
cx.render(rsx! {
footer {
span {
strong {"{items_left}"}
+2 -2
View File
@@ -10,8 +10,8 @@ use dioxus_web::{prelude::*, WebsysRenderer};
static APP_STYLE: &'static str = include_str!("./style.css");
fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|ctx| {
ctx.render(rsx! {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|cx| {
cx.render(rsx! {
div {
id: "app"
// style { "{APP_STYLE}" }
+2 -2
View File
@@ -33,10 +33,10 @@ impl RecoilContext<()> {
// let (set, get) = (self.set, self.get);
// TOODS
// .get(&ctx)
// .get(&cx)
// .iter()
// .filter(|(k, v)| v.checked)
// .map(|(k, v)| TODOS.remove(&ctx, k));
// .map(|(k, v)| TODOS.remove(&cx, k));
}
pub fn set_filter(&self, filter: &FilterState) {}
+4 -4
View File
@@ -7,11 +7,11 @@ pub struct TodoEntryProps {
id: uuid::Uuid,
}
pub fn TodoEntry(ctx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&ctx, || false);
let todo = use_atom_family(&ctx, &TODOS, ctx.id);
pub fn TodoEntry(cx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&cx, || false);
let todo = use_atom_family(&cx, &TODOS, cx.id);
ctx.render(rsx! (
cx.render(rsx! (
li {
"{todo.id}"
input {
+5 -5
View File
@@ -6,12 +6,12 @@ use crate::{
};
use dioxus_core::prelude::*;
pub fn TodoList(ctx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&ctx, || "".to_string());
let (todos, _) = use_state(&ctx, || Vec::<TodoItem>::new());
let filter = use_atom(&ctx, &FILTER);
pub fn TodoList(cx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&cx, || "".to_string());
let (todos, _) = use_state(&cx, || Vec::<TodoItem>::new());
let filter = use_atom(&cx, &FILTER);
ctx.render(rsx! {
cx.render(rsx! {
div {
header {
class: "header"