forked from DECA/DECA-Protocol-FE
Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
itzelot01 | d43f6ab02b | |
itzelot01 | 35bc3d5ed4 |
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "trunk-template"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Template for starting a Yew project using Trunk"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/yewstack/yew-trunk-minimal-template"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["yew", "trunk"]
|
||||
categories = ["gui", "wasm", "web-programming"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dependencies]
|
||||
js-sys = "0.3.66"
|
||||
once_cell = "1.18.0"
|
||||
wasm-bindgen = "0.2.90"
|
||||
wasm-bindgen-futures = "0.4.39"
|
||||
yew = { version="0.20", features=["csr"] }
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>DECA NFTs</title>
|
||||
<script scr = "/js/script.js"></script>
|
||||
<link data-trunk rel="sass" href="index.scss">
|
||||
</head>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
align-items: left;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
background: linear-gradient(#cfb0da 42.44%, #a530e4);
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
main {
|
||||
color: #340034;
|
||||
font-family: TimesNewRoman;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 + .subtitle {
|
||||
display: block;
|
||||
margin-top: -1em;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
export function get_now_date() {
|
||||
console.log("get_now_date called!");
|
||||
var curr_date = new Date();
|
||||
return curr_date.toDateString();
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(module = "/js/script.js")]
|
||||
extern "C" {
|
||||
#[wasm_bindgen]
|
||||
pub fn get_now_date() -> String;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
use yew::prelude::*;
|
||||
|
||||
mod bindings;
|
||||
|
||||
struct App;
|
||||
|
||||
impl Component for App {
|
||||
type Message = ();
|
||||
type Properties = ();
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn view(&self, _ctx: &Context<Self>) -> Html {
|
||||
//let get_obj = bindings::getObj();
|
||||
//let obj = use_memo((), get_obj);
|
||||
html! {
|
||||
<div class="section">
|
||||
<div class="container">
|
||||
<main>
|
||||
<h1 class="title">{"DECA NFTs"}</h1>
|
||||
<h4>{"These are the DECA NFTs available for giveaway"}</h4>
|
||||
<h2 class="subtitle">{bindings::get_now_date()}</h2>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
Loading…
Reference in New Issue