From eea743e8d5641aeb710ee63ffa3c45fab700da79 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 14 Feb 2025 22:25:23 -0800 Subject: [PATCH] Cleaned up a ton --- public/clipboard-check.svg | 1 + public/clipboard.svg | 1 + src/global.css | 119 +++++++++++++++++++++++++++++++++++++ src/main.ts | 30 +++++++++- 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 public/clipboard-check.svg create mode 100644 public/clipboard.svg create mode 100644 src/global.css diff --git a/public/clipboard-check.svg b/public/clipboard-check.svg new file mode 100644 index 0000000..ffd5564 --- /dev/null +++ b/public/clipboard-check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/clipboard.svg b/public/clipboard.svg new file mode 100644 index 0000000..deea4b9 --- /dev/null +++ b/public/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/global.css b/src/global.css new file mode 100644 index 0000000..6583192 --- /dev/null +++ b/src/global.css @@ -0,0 +1,119 @@ +@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"); + +:root { + font-family: + Inter, + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + Oxygen, + Ubuntu, + Cantarell, + "Open Sans", + "Helvetica Neue", + sans-serif; + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html, +body { + height: 100%; + width: 100%; +} + +body { + line-height: 1.5; + font-weight: 400; + font-size: 16px; + color: #1a1a1a; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 600; + line-height: 1.2; +} + +a { + color: #444444; +} +a:hover { + color: #888888; +} + +button { + font: inherit; + border: none; + background: none; + cursor: pointer; +} + +input, +textarea { + font: inherit; +} + +/* Add these new styles */ +.url-container { + display: flex; + align-items: center; + gap: 8px; + margin-top: 16px; +} + +/* Add this new style */ +.content-container { + max-width: 36rem; + text-align: center; +} + +/* Update url-input width to be 100% since container will control max width */ +.url-input { + padding: 8px 12px; + border: 1px solid #ddd; + border-radius: 4px; + width: 100%; + background: #f5f5f5; +} + +.copy-button { + padding: 8px; + color: #666; + border-radius: 4px; + transition: all 0.2s; + display: flex; + align-items: center; + justify-content: center; +} + +.copy-button:hover { + background: #f0f0f0; +} + +.copy-button:active { + background: #e5e5e5; +} + +.copy-button img { + width: 20px; + height: 20px; +} + +.copy-button.copied { + background: #28a745; +} diff --git a/src/main.ts b/src/main.ts index f8d584a..ef4aac9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { bangs } from "./bang"; +import "./global.css"; const defaultBang = bangs.find((b) => b.t === "g"); @@ -6,9 +7,36 @@ function noSearchDefaultPageRender() { const app = document.querySelector("#app")!; app.innerHTML = `
-

Unduck

+
+

Unduck

+

DuckDuckGo's bang redirects are too slow. Add the following URL as a custom search engine to your browser. Enables all of DuckDuckGo's bangs.

+
+ + +
+
`; + + const copyButton = app.querySelector(".copy-button")!; + const copyIcon = copyButton.querySelector("img")!; + const urlInput = app.querySelector(".url-input")!; + + copyButton.addEventListener("click", async () => { + await navigator.clipboard.writeText(urlInput.value); + copyIcon.src = "/clipboard-check.svg"; + + setTimeout(() => { + copyIcon.src = "/clipboard.svg"; + }, 2000); + }); } function getBangredirectUrl() {