From 7456dc105a14eb8ab56f80464eded53e5d0449d1 Mon Sep 17 00:00:00 2001 From: rav4s Date: Thu, 1 Apr 2021 09:40:34 -0500 Subject: [PATCH] insert codons in correct div --- src/lib.rs | 6 +++--- www/app.html | 11 ++++++++++- www/css/styles.css | 26 ++++++++++++++++++++++++-- www/index.html | 8 +++++++- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d98249d..58d187d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -159,16 +159,16 @@ pub fn main(mut strand: String) { // window object. let window = web_sys::window().expect("no global `window` exists"); let document = window.document().expect("should have a document on window"); - let body = document.body().expect("document should have a body"); + let codons_div = document.get_element_by_id("codons").expect("codons div should exist"); let val = document.create_element("h2").unwrap(); val.set_text_content(Some("Codons:")); - body.append_child(&val).unwrap(); + codons_div.append_with_node_1(&val).unwrap(); print!("The translated amino acids are: "); for i in amino_acids_list { let val = document.create_element("p").unwrap(); val.set_text_content(Some(&i)); - body.append_child(&val).unwrap(); + codons_div.append_with_node_1(&val).unwrap(); } } diff --git a/www/app.html b/www/app.html index 7bfb954..74fe338 100644 --- a/www/app.html +++ b/www/app.html @@ -1,12 +1,21 @@ - + + + DNA Transcription & Translation +

DNA Transcription & Translation

+
+ +
+ diff --git a/www/css/styles.css b/www/css/styles.css index b835c16..6a7e690 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -1,3 +1,18 @@ +:root { + --primary-bg-color: #568ea3; + --secondary-bg-color: #E96400; + --main-highlight-color: #a40e4c; +} + +::selection { + background: var(--main-highlight-color); /* WebKit/Blink Browsers */ +} + +::-moz-selection { + background: var(--main-highlight-color); /* Gecko Browsers */ +} + + * { box-sizing: border-box; } @@ -10,13 +25,20 @@ body { margin: 0; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; height: 100%; + background-color: var(--primary-bg-color); + color: white; } -h1 { +h1, h2 { all: initial; } -h1 { +h1, h2 { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; font-size: 23.5px; + color: white; +} + +.input-div { + } diff --git a/www/index.html b/www/index.html index 0a70b97..7a7dea1 100644 --- a/www/index.html +++ b/www/index.html @@ -1,8 +1,11 @@ - + + + DNA Transcription & Translation + @@ -11,5 +14,8 @@ +