|
@@ -35,14 +35,16 @@ fn App(cx: Scope) -> Element {
|
|
rel: "stylesheet",
|
|
rel: "stylesheet",
|
|
href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css",
|
|
href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css",
|
|
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
|
|
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
|
|
- crossorigin: "anonymous",
|
|
|
|
|
|
+ crossorigin: "anonymous"
|
|
}
|
|
}
|
|
|
|
|
|
- style { "
|
|
|
|
|
|
+ style {
|
|
|
|
+ "
|
|
.red {{
|
|
.red {{
|
|
background-color: rgb(202, 60, 60) !important;
|
|
background-color: rgb(202, 60, 60) !important;
|
|
}}
|
|
}}
|
|
- " }
|
|
|
|
|
|
+ "
|
|
|
|
+ }
|
|
|
|
|
|
h1 { "Dioxus CRM Example" }
|
|
h1 { "Dioxus CRM Example" }
|
|
|
|
|
|
@@ -57,22 +59,14 @@ fn ClientList(cx: Scope) -> Element {
|
|
cx.render(rsx! {
|
|
cx.render(rsx! {
|
|
h2 { "List of Clients" }
|
|
h2 { "List of Clients" }
|
|
|
|
|
|
- Link {
|
|
|
|
- to: Route::ClientAdd {},
|
|
|
|
- class: "pure-button pure-button-primary",
|
|
|
|
- "Add Client"
|
|
|
|
- }
|
|
|
|
- Link {
|
|
|
|
- to: Route::Settings {},
|
|
|
|
- class: "pure-button",
|
|
|
|
- "Settings"
|
|
|
|
- }
|
|
|
|
|
|
+ Link { to: Route::ClientAdd {}, class: "pure-button pure-button-primary", "Add Client" }
|
|
|
|
+ Link { to: Route::Settings {}, class: "pure-button", "Settings" }
|
|
|
|
|
|
clients.read().iter().map(|client| rsx! {
|
|
clients.read().iter().map(|client| rsx! {
|
|
div {
|
|
div {
|
|
class: "client",
|
|
class: "client",
|
|
style: "margin-bottom: 50px",
|
|
style: "margin-bottom: 50px",
|
|
-
|
|
|
|
|
|
+
|
|
p { "Name: {client.first_name} {client.last_name}" }
|
|
p { "Name: {client.first_name} {client.last_name}" }
|
|
p { "Description: {client.description}" }
|
|
p { "Description: {client.description}" }
|
|
}
|
|
}
|
|
@@ -94,23 +88,18 @@ fn ClientAdd(cx: Scope) -> Element {
|
|
class: "pure-form pure-form-aligned",
|
|
class: "pure-form pure-form-aligned",
|
|
onsubmit: move |_| {
|
|
onsubmit: move |_| {
|
|
let mut clients = clients.write();
|
|
let mut clients = clients.write();
|
|
-
|
|
|
|
- clients.push(Client {
|
|
|
|
- first_name: first_name.to_string(),
|
|
|
|
- last_name: last_name.to_string(),
|
|
|
|
- description: description.to_string(),
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ clients
|
|
|
|
+ .push(Client {
|
|
|
|
+ first_name: first_name.to_string(),
|
|
|
|
+ last_name: last_name.to_string(),
|
|
|
|
+ description: description.to_string(),
|
|
|
|
+ });
|
|
dioxus_router::router().push(Route::ClientList {});
|
|
dioxus_router::router().push(Route::ClientList {});
|
|
},
|
|
},
|
|
|
|
|
|
fieldset {
|
|
fieldset {
|
|
- div {
|
|
|
|
- class: "pure-control-group",
|
|
|
|
- label {
|
|
|
|
- "for": "first_name",
|
|
|
|
- "First Name"
|
|
|
|
- }
|
|
|
|
|
|
+ div { class: "pure-control-group",
|
|
|
|
+ label { "for": "first_name", "First Name" }
|
|
input {
|
|
input {
|
|
id: "first_name",
|
|
id: "first_name",
|
|
"type": "text",
|
|
"type": "text",
|
|
@@ -121,12 +110,8 @@ fn ClientAdd(cx: Scope) -> Element {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- div {
|
|
|
|
- class: "pure-control-group",
|
|
|
|
- label {
|
|
|
|
- "for": "last_name",
|
|
|
|
- "Last Name"
|
|
|
|
- }
|
|
|
|
|
|
+ div { class: "pure-control-group",
|
|
|
|
+ label { "for": "last_name", "Last Name" }
|
|
input {
|
|
input {
|
|
id: "last_name",
|
|
id: "last_name",
|
|
"type": "text",
|
|
"type": "text",
|
|
@@ -137,12 +122,8 @@ fn ClientAdd(cx: Scope) -> Element {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- div {
|
|
|
|
- class: "pure-control-group",
|
|
|
|
- label {
|
|
|
|
- "for": "description",
|
|
|
|
- "Description"
|
|
|
|
- }
|
|
|
|
|
|
+ div { class: "pure-control-group",
|
|
|
|
+ label { "for": "description", "Description" }
|
|
textarea {
|
|
textarea {
|
|
id: "description",
|
|
id: "description",
|
|
placeholder: "Description…",
|
|
placeholder: "Description…",
|
|
@@ -151,22 +132,11 @@ fn ClientAdd(cx: Scope) -> Element {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- div {
|
|
|
|
- class: "pure-controls",
|
|
|
|
- button {
|
|
|
|
- "type": "submit",
|
|
|
|
- class: "pure-button pure-button-primary",
|
|
|
|
- "Save"
|
|
|
|
- }
|
|
|
|
- Link {
|
|
|
|
- to: Route::ClientList {},
|
|
|
|
- class: "pure-button pure-button-primary red",
|
|
|
|
- "Cancel"
|
|
|
|
- }
|
|
|
|
|
|
+ div { class: "pure-controls",
|
|
|
|
+ button { "type": "submit", class: "pure-button pure-button-primary", "Save" }
|
|
|
|
+ Link { to: Route::ClientList {}, class: "pure-button pure-button-primary red", "Cancel" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -187,10 +157,6 @@ fn Settings(cx: Scope) -> Element {
|
|
"Remove all Clients"
|
|
"Remove all Clients"
|
|
}
|
|
}
|
|
|
|
|
|
- Link {
|
|
|
|
- to: Route::ClientList {},
|
|
|
|
- class: "pure-button",
|
|
|
|
- "Go back"
|
|
|
|
- }
|
|
|
|
|
|
+ Link { to: Route::ClientList {}, class: "pure-button", "Go back" }
|
|
})
|
|
})
|
|
}
|
|
}
|