Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
refactor: remove leptos template stuff, replace it with our own
Browse files Browse the repository at this point in the history
  • Loading branch information
mazziechai committed Mar 29, 2024
1 parent 4f59a2f commit 8e652fd
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 70 deletions.
119 changes: 106 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ license = "MPL-2.0"
leptos = { version = "0.6", features = ["csr", "nightly"] }
leptos_meta = { version = "0.6", features = ["csr", "nightly"] }
leptos_router = { version = "0.6", features = ["csr", "nightly"] }
console_log = "1"
console_error_panic_hook = "0.1"
log = "0.4"
anyhow = "1.0.81"
meteor-rs = { git = "https://github.com/orbit-systems/meteor", version = "0.1.0" }
tracing = "0.1.40"
console_error_panic_hook = "0.1.7"
tracing-wasm = "0.2.1"
tracing-log = "0.2.0"
web-sys = { version = "0.3", features = [
"WebGlBuffer",
"WebGl2RenderingContext",
"WebGlVertexArrayObject",
"WebGlProgram",
"WebGlShader",
] }

[dev-dependencies]
wasm-bindgen = "0.2"
Expand Down
Binary file added public/JetBrainsMono-Regular.woff2
Binary file not shown.
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Allow: /
20 changes: 9 additions & 11 deletions public/styles.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
/* --------------------- Open Props --------------------------- */

/* the props */
@import "https://unpkg.com/open-props";

/* optional imports that use the props */
@import "https://unpkg.com/open-props/normalize.min.css";
@import "https://unpkg.com/open-props/buttons.min.css";

/* ------------------------------------------------------------ */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap");

body {
font-family: sans-serif;
font-family: Inter, sans-serif;
text-align: center;
}

Expand All @@ -26,6 +17,13 @@ body {
justify-content: space-evenly;
}

.meteor-output {
font-family: "JetBrains Mono", monospace;
font-size: 11;
text-wrap: wrap;
overflow: scroll;
}

h1,
h2,
h3,
Expand Down
16 changes: 0 additions & 16 deletions src/components/counter_btn.rs

This file was deleted.

15 changes: 15 additions & 0 deletions src/components/meteor_component.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use leptos::*;

/// The component that displays the Meteor emulator.
#[component]
pub fn Meteor() -> impl IntoView {
view! {
<textarea class="meteor-output" name="output" rows="24" cols="80">
Test
</textarea>

<canvas id="meteor" width="800" height="600">

</canvas>
}
}
2 changes: 1 addition & 1 deletion src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod counter_btn;
pub mod meteor_component;
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn App() -> impl IntoView {
<Html lang="en" dir="ltr" attr:data-theme="light"/>

// sets the document title
<Title text="Welcome to Leptos CSR"/>
<Title text="Nova: Aphelion ISA Playground"/>

// injects metadata in the <head> of the page
<Meta charset="UTF-8"/>
Expand Down
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ use leptos::*;

use nova_playground::App;

fn main() {
// set up logging
_ = console_log::init_with_level(log::Level::Debug);
fn main() -> anyhow::Result<()> {
// Setup logging
console_error_panic_hook::set_once();
tracing_wasm::set_as_global_default();
tracing_log::LogTracer::init()?;

mount_to_body(|| {
view! {
<App />
}
})
});

Ok(())
}
1 change: 1 addition & 0 deletions src/meteor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

25 changes: 4 additions & 21 deletions src/pages/home.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use leptos::*;

use crate::components::counter_btn::Button;
use crate::components::meteor_component::Meteor;

/// Default Home Page
#[component]
Expand All @@ -26,28 +26,11 @@ pub fn Home() -> impl IntoView {
}>

<div class="container">
<h1>"nova"</h1>

<picture>
<source
srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_pref_dark_RGB.svg"
media="(prefers-color-scheme: dark)"
/>
<img
src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg"
alt="Leptos Logo"
height="200"
width="400"
/>
</picture>

<h1>"Welcome to Leptos"</h1>

<div class="buttons">
<Button/>
<Button increment=5/>
</div>

<Meteor/>
</div>

</ErrorBoundary>
}
}

0 comments on commit 8e652fd

Please sign in to comment.