From b0559cafba380ef2e1b1626756f0f51faa1fa604 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Tue, 17 Oct 2023 13:51:12 -0600 Subject: [PATCH 1/8] Refactor auth form --- tools/ui/Cargo.lock | 2 +- tools/ui/src/auth/auth.ts | 42 +++++++++++---------------------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/tools/ui/Cargo.lock b/tools/ui/Cargo.lock index 7e687c39..b36fc70c 100644 --- a/tools/ui/Cargo.lock +++ b/tools/ui/Cargo.lock @@ -111,7 +111,7 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "candid" -version = "0.9.9" +version = "0.9.10" dependencies = [ "anyhow", "binread", diff --git a/tools/ui/src/auth/auth.ts b/tools/ui/src/auth/auth.ts index d6bdfe09..83dd0003 100644 --- a/tools/ui/src/auth/auth.ts +++ b/tools/ui/src/auth/auth.ts @@ -20,7 +20,7 @@ function insertLoginForm() { if (!cid) { throw new Error("No canister ID available for authentication") } else { - const auth = document.getElementById("authentication") + const auth = document.getElementById("authentication")! const buttonLogin = document.createElement("button") buttonLogin.className = "btn" @@ -40,38 +40,20 @@ function insertLoginForm() { await login(options) }) - const { raw, raw_label, domain, domain_label } = domainForm() - - auth!.innerHTML = "" - auth!.appendChild(raw) - auth!.appendChild(raw_label) - auth!.appendChild(domain) - auth!.appendChild(domain_label) - auth!.appendChild(buttonLogin) + auth.innerHTML = ` + + + ` + auth.appendChild(buttonLogin); } } -function domainForm() { - const raw = document.createElement("input") - raw.id = "raw" - raw.type = "checkbox" - raw.checked = true - - const raw_label = document.createElement("label") - raw_label.innerText = "raw" - raw_label.style.marginRight = "10px" - - const domain = document.createElement("input") - domain.id = "domain" - domain.type = "checkbox" - domain.checked = true - - const domain_label = document.createElement("label") - domain_label.innerText = "icp0.io" - - return { raw, raw_label, domain, domain_label } -} - function insertLogout() { const auth = document.getElementById("authentication") auth!.innerHTML = "" From 966d5abfefb6a8e368d656cf3467f9d3a61c25e1 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Tue, 17 Oct 2023 14:09:30 -0600 Subject: [PATCH 2/8] Set up responsive text in login button --- tools/ui/src/auth/auth.ts | 2 +- tools/ui/src/candid.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/ui/src/auth/auth.ts b/tools/ui/src/auth/auth.ts index 83dd0003..688d7deb 100644 --- a/tools/ui/src/auth/auth.ts +++ b/tools/ui/src/auth/auth.ts @@ -25,7 +25,7 @@ function insertLoginForm() { const buttonLogin = document.createElement("button") buttonLogin.className = "btn" buttonLogin.style.margin = "10px" - buttonLogin.innerHTML = `${dfinity_logo} Login with Internet Identity` + buttonLogin.innerHTML = `${dfinity_logo} Login with Internet Identity` const canisterId = Principal.fromText(cid) diff --git a/tools/ui/src/candid.css b/tools/ui/src/candid.css index a4c62720..caf5782c 100644 --- a/tools/ui/src/candid.css +++ b/tools/ui/src/candid.css @@ -330,6 +330,12 @@ textarea:focus { background-color: var(--darkest); } +@media not screen and (min-width: 800px) { + .hide-narrow { + display: none; + } +} + @media only screen and (min-width: 800px) { :root { --header-height: 5.6rem; From ee2a1e34fab234e307246e404a96f25240bdfa4e Mon Sep 17 00:00:00 2001 From: rvanasa Date: Tue, 17 Oct 2023 17:20:40 -0600 Subject: [PATCH 3/8] Adjust styling --- tools/ui/src/auth/auth.ts | 9 +++++--- tools/ui/src/candid.css | 43 +++++++++++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/tools/ui/src/auth/auth.ts b/tools/ui/src/auth/auth.ts index 688d7deb..f7bc3bf4 100644 --- a/tools/ui/src/auth/auth.ts +++ b/tools/ui/src/auth/auth.ts @@ -23,9 +23,12 @@ function insertLoginForm() { const auth = document.getElementById("authentication")! const buttonLogin = document.createElement("button") - buttonLogin.className = "btn" - buttonLogin.style.margin = "10px" - buttonLogin.innerHTML = `${dfinity_logo} Login with Internet Identity` + buttonLogin.className = "btn btn-auth" + buttonLogin.innerHTML = ` + ${dfinity_logo} + Login + Login with Internet Identity + ` const canisterId = Principal.fromText(cid) diff --git a/tools/ui/src/candid.css b/tools/ui/src/candid.css index caf5782c..849dde34 100644 --- a/tools/ui/src/candid.css +++ b/tools/ui/src/candid.css @@ -1,9 +1,9 @@ :root { - font-family: 'Circular Std', 'Roboto', sans-serif; + font-family: "Circular Std", "Roboto", sans-serif; font-weight: 300; font-size: 10px; - --font-circular: 'Circular Std', 'Roboto', sans-serif; - --font-mono: 'Vremena Grotesk', 'Roboto Mono', monospace; + --font-circular: "Circular Std", "Roboto", sans-serif; + --font-mono: "Vremena Grotesk", "Roboto Mono", monospace; --header-height: 3.8rem; --pad-sm: 0.8rem; --pad-md: 1.5rem; @@ -66,7 +66,7 @@ } #methods { - font-family: 'Vremena Grotesk', 'Roboto Mono', monospace; + font-family: "Vremena Grotesk", "Roboto Mono", monospace; padding: 0; margin: 0; } @@ -95,22 +95,22 @@ input, select { font-size: var(--font-md); - font-family: 'Circular Std', 'Roboto', sans-serif; + font-family: "Circular Std", "Roboto", sans-serif; margin-bottom: var(--pad-lg); } -input:not([type='checkbox']), +input:not([type="checkbox"]), select { width: 100%; height: 4.8rem; padding: 1.5rem; border: 1px solid var(--dark); } -input[type='number']::-webkit-inner-spin-button { +input[type="number"]::-webkit-inner-spin-button { width: 3rem; height: 3rem; } label { - font-family: 'Circular Std', 'Roboto', sans-serif; + font-family: "Circular Std", "Roboto", sans-serif; margin-right: var(--pad-sm); } label.small { @@ -120,7 +120,7 @@ label.small { padding-left: var(--pad-md); width: 100%; } -input[type='checkbox'] ~ .popup-form { +input[type="checkbox"] ~ .popup-form { padding-left: var(--pad-md); } .input-container > span > .popup-form, @@ -178,7 +178,7 @@ input[type='checkbox'] ~ .popup-form { } .btn { - font-family: 'Roboto', sans-serif; + font-family: "Roboto", sans-serif; letter-spacing: 0.05rem; background-color: var(--darkest); color: var(--lightest); @@ -192,6 +192,12 @@ input[type='checkbox'] ~ .popup-form { .btn:not(:last-child) { margin-right: var(--pad-md); } +.btn-auth { + display: inline-flex; + align-items: center; + gap: 5px; + margin: 10px; +} button { padding: 0; border: none; @@ -330,6 +336,17 @@ textarea:focus { background-color: var(--darkest); } +@media not screen and (min-width: 600px) { + :root { + --header-height: 8rem; + } + + #header { + flex-direction: column; + align-items: start; + } +} + @media not screen and (min-width: 800px) { .hide-narrow { display: none; @@ -342,6 +359,10 @@ textarea:focus { --console-width: clamp(28rem, 30vw, 40rem); } + .show-narrow { + display: none; + } + #header { text-align: left; padding-left: 3rem; @@ -371,7 +392,7 @@ textarea:focus { .ui-result span:not(:first-child):not(.status) { margin-left: var(--pad-md); } - input:not([type='checkbox']), + input:not([type="checkbox"]), select { width: 23.2rem; height: 4rem; From f1fe5fabd556108689d493daada4cd04e38c50a9 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Tue, 17 Oct 2023 17:36:09 -0600 Subject: [PATCH 4/8] Unformat --- tools/ui/src/candid.css | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/ui/src/candid.css b/tools/ui/src/candid.css index 849dde34..8be4a925 100644 --- a/tools/ui/src/candid.css +++ b/tools/ui/src/candid.css @@ -1,9 +1,9 @@ :root { - font-family: "Circular Std", "Roboto", sans-serif; + font-family: 'Circular Std', 'Roboto', sans-serif; font-weight: 300; font-size: 10px; - --font-circular: "Circular Std", "Roboto", sans-serif; - --font-mono: "Vremena Grotesk", "Roboto Mono", monospace; + --font-circular: 'Circular Std', 'Roboto', sans-serif; + --font-mono: 'Vremena Grotesk', 'Roboto Mono', monospace; --header-height: 3.8rem; --pad-sm: 0.8rem; --pad-md: 1.5rem; @@ -66,7 +66,7 @@ } #methods { - font-family: "Vremena Grotesk", "Roboto Mono", monospace; + font-family: 'Vremena Grotesk', 'Roboto Mono', monospace; padding: 0; margin: 0; } @@ -95,22 +95,22 @@ input, select { font-size: var(--font-md); - font-family: "Circular Std", "Roboto", sans-serif; + font-family: 'Circular Std', 'Roboto', sans-serif; margin-bottom: var(--pad-lg); } -input:not([type="checkbox"]), +input:not([type='checkbox']), select { width: 100%; height: 4.8rem; padding: 1.5rem; border: 1px solid var(--dark); } -input[type="number"]::-webkit-inner-spin-button { +input[type='number']::-webkit-inner-spin-button { width: 3rem; height: 3rem; } label { - font-family: "Circular Std", "Roboto", sans-serif; + font-family: 'Circular Std', 'Roboto', sans-serif; margin-right: var(--pad-sm); } label.small { @@ -120,7 +120,7 @@ label.small { padding-left: var(--pad-md); width: 100%; } -input[type="checkbox"] ~ .popup-form { +input[type='checkbox'] ~ .popup-form { padding-left: var(--pad-md); } .input-container > span > .popup-form, @@ -178,7 +178,7 @@ input[type="checkbox"] ~ .popup-form { } .btn { - font-family: "Roboto", sans-serif; + font-family: 'Roboto', sans-serif; letter-spacing: 0.05rem; background-color: var(--darkest); color: var(--lightest); @@ -392,7 +392,7 @@ textarea:focus { .ui-result span:not(:first-child):not(.status) { margin-left: var(--pad-md); } - input:not([type="checkbox"]), + input:not([type='checkbox']), select { width: 23.2rem; height: 4rem; From fe5b30713d9d6bbca9cb206e791942156a4e7a4f Mon Sep 17 00:00:00 2001 From: rvanasa Date: Wed, 18 Oct 2023 11:15:37 -0600 Subject: [PATCH 5/8] Improve responsive layout --- tools/ui/src/candid.css | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/ui/src/candid.css b/tools/ui/src/candid.css index 8be4a925..0ebdc947 100644 --- a/tools/ui/src/candid.css +++ b/tools/ui/src/candid.css @@ -196,7 +196,6 @@ input[type='checkbox'] ~ .popup-form { display: inline-flex; align-items: center; gap: 5px; - margin: 10px; } button { padding: 0; @@ -338,12 +337,16 @@ textarea:focus { @media not screen and (min-width: 600px) { :root { - --header-height: 8rem; + --header-height: 9rem; } #header { flex-direction: column; - align-items: start; + margin-top: 1rem; + } + + .btn-auth { + padding: 10px; } } @@ -460,4 +463,8 @@ textarea:focus { #methods-list { height: calc(100vh - (var(--header-height) * 2)); } + + .btn-auth { + margin: 10px; + } } From d79b34c9f673bf43505dfc99dadb28a8e3f050c3 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Wed, 18 Oct 2023 11:37:08 -0600 Subject: [PATCH 6/8] Progress --- tools/ui/src/auth/auth.ts | 4 ++-- tools/ui/src/candid.css | 23 ++++++++++++----------- tools/ui/src/candid.html | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/ui/src/auth/auth.ts b/tools/ui/src/auth/auth.ts index f7bc3bf4..9f7688a5 100644 --- a/tools/ui/src/auth/auth.ts +++ b/tools/ui/src/auth/auth.ts @@ -44,11 +44,11 @@ function insertLoginForm() { }) auth.innerHTML = ` -