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
use yew::prelude::*; | |
#[derive(Properties, PartialEq)] | |
pub struct MessageProp { | |
pub text: String, | |
pub css_class: String, | |
} | |
#[function_component(Message)] | |
pub fn message(MessageProp { text, css_class }: &MessageProp) -> Html { |
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
use yew::prelude::*; | |
#[function_component(Loader)] | |
pub fn loader() -> Html { | |
html! { | |
<div class="spinner-border" role="status"> | |
<span class="visually-hidden">{"Loading..."}</span> | |
</div> | |
} | |
} |
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
use yew::prelude::*; | |
#[function_component(Header)] | |
pub fn header() -> Html { | |
html! { | |
<nav class="navbar bg-black"> | |
<div class="container-fluid"> | |
<a class="navbar-brand text-white" href="#">{"User List"}</a> | |
</div> | |
</nav> |
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
{ | |
"users": [ | |
{ | |
"id": 1, | |
"firstName": "Terry", | |
"lastName": "Medhurst", | |
"maidenName": "Smitham", | |
"age": 50, | |
"gender": "male", | |
"email": "[email protected]", |
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
use serde::Deserialize; | |
#[derive(Clone, Deserialize, PartialEq)] | |
#[serde(rename_all = "camelCase")] | |
pub struct User { | |
pub first_name: String, | |
pub last_name: String, | |
pub email: String, | |
pub gender: String, | |
pub phone: String, |
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
use yew::prelude::*; | |
//add below | |
mod components; | |
mod models; | |
#[function_component(App)] | |
fn app() -> Html { | |
//app code goes here | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous"> | |
<title>Yew Starter</title> | |
</head> | |
<body> |
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
use yew::prelude::*; | |
#[function_component(App)] | |
fn app() -> Html { | |
html! { | |
<h1 class="text-primary">{ "Yew for React developers" }</h1> | |
} | |
} | |
fn main() { |
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
//other code section goes here | |
[dependencies] | |
yew = "0.19" | |
serde = "1.0.144" | |
gloo-net = "0.2" | |
wasm-bindgen-futures = "0.4" |
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
mod config; | |
mod handler; | |
mod schemas; | |
//add | |
use async_graphql::{ | |
http::{playground_source, GraphQLPlaygroundConfig}, | |
EmptySubscription, Schema, | |
}; | |
use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; |