-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
892 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Web assembly on top of Rust. | ||
|
||
Single Page Applications using Rust |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>RustSPA</title> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" | ||
/> | ||
<link rel="stylesheet" type="text/css" href="/styles.css" /> | ||
<script type="module"> | ||
import init from './wasm.js'; | ||
init(); | ||
</script> | ||
<link rel="shortcut icon" href="#" /> | ||
</head> | ||
<body> | ||
<div class="loading_spinner_container"> | ||
<div class="loading_spinner"></div> | ||
<div class="loading_spinner_text">Loading ...</div> | ||
</div> | ||
</body> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "rustSPA", | ||
"collaborators": [ | ||
"iwanbazz <[email protected]>" | ||
], | ||
"version": "0.1.0", | ||
"files": [ | ||
"wasm_bg.wasm", | ||
"wasm.js", | ||
"wasm.d.ts" | ||
], | ||
"module": "wasm.js", | ||
"types": "wasm.d.ts", | ||
"sideEffects": false | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"name": "Apple", | ||
"description": "An apple a day keeps the doctor away", | ||
"image": "/products/apple.png", | ||
"price": 3.65 | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Banana", | ||
"description": "An old banana leaf was once young and green", | ||
"image": "/products/banana.png", | ||
"price": 7.99 | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
body { | ||
font-family: 'Source Sans Pro', sans-serif; | ||
-webkit-font-smoothing: subpixel-antialiased; | ||
color: #333; | ||
background: #f7f7f7; | ||
padding-bottom: calc(24px + env(safe-area-inset-bottom)); | ||
} | ||
|
||
.navbar { | ||
height: 44px; | ||
background: #dd2c00; | ||
color: white; | ||
box-shadow: 0px 5px 12px 0px rgba(46, 51, 51, 0.18); | ||
position: sticky; | ||
top: 0; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.navbar_title { | ||
font-weight: bold; | ||
font-size: 24px; | ||
margin-left: 10px; | ||
} | ||
|
||
.navbar_cart_value { | ||
font-weight: bold; | ||
font-size: 13px; | ||
margin-right: 10px; | ||
background: #b91400; | ||
padding: 5px 10px; | ||
border-radius: 4px; | ||
} | ||
|
||
.product_card_list { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); | ||
grid-gap: 10px; | ||
padding: 10px; | ||
} | ||
|
||
.product_card_container { | ||
border: 1px solid #eee; | ||
border-radius: 4px; | ||
padding: 10px; | ||
cursor: pointer; | ||
box-shadow: 0px 1px 10px 0px rgba(46, 51, 51, 0.18); | ||
background: white; | ||
} | ||
|
||
.product_card_container:hover { | ||
border-color: #ddd; | ||
transition: background, border-color 300ms; | ||
} | ||
|
||
.product_card_anchor { | ||
text-decoration: none; | ||
color: #333; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.product_card_image { | ||
width: 80%; | ||
object-fit: contain; | ||
} | ||
|
||
.product_card_name, | ||
.product_card_price, | ||
.product_atc_button { | ||
margin-top: 10px; | ||
} | ||
|
||
.product_card_name { | ||
font-weight: bold; | ||
} | ||
|
||
.product_atc_button { | ||
width: 100%; | ||
height: 44px; | ||
border-radius: 4px; | ||
border: 0; | ||
cursor: pointer; | ||
background: #dd2c00; | ||
color: white; | ||
transition: background 300ms; | ||
font-weight: bold; | ||
} | ||
|
||
.product_atc_button:hover { | ||
background: #ddd; | ||
background: #c41c00; | ||
} | ||
|
||
.product_detail_container { | ||
padding: 10px; | ||
cursor: pointer; | ||
background: white; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.product_detail_image { | ||
height: 30vh; | ||
} | ||
|
||
.loading_spinner_container { | ||
height: 100vh; | ||
width: 100vw; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.loading_spinner { | ||
border-radius: 50%; | ||
width: 18px; | ||
height: 18px; | ||
border: 2px solid #333; | ||
border-top-color: #fff; | ||
animation: loading_spinner_animation 1s infinite linear; | ||
} | ||
|
||
@keyframes loading_spinner_animation { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.loading_spinner_text { | ||
margin-top: 10px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
*/ | ||
export function run_app(): void; | ||
|
||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
|
||
export interface InitOutput { | ||
readonly memory: WebAssembly.Memory; | ||
readonly run_app: () => void; | ||
readonly __wbindgen_malloc: (a: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number; | ||
readonly __wbindgen_export_2: WebAssembly.Table; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce8643ed01dae7e2: (a: number, b: number, c: number) => void; | ||
readonly _dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he3cff5d5efe70599: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
readonly __wbindgen_start: () => void; | ||
} | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {InitInput | Promise<InitInput>} module_or_path | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; | ||
|
Oops, something went wrong.