From 11e1f4593ab1025a49149fa8da7bb73aa72f615a Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Thu, 1 Aug 2024 23:31:24 +0100 Subject: [PATCH] Added search bar. --- frontend/src/lib/components/post-min.svelte | 8 +- frontend/src/lib/components/search.svelte | 107 ++++++++++++++++++ .../src/lib/components/svg-icon-custom.svelte | 56 +++++++++ frontend/src/lib/css/search.css | 49 ++++++++ frontend/src/lib/css/style.css | 50 ++++++++ frontend/src/routes/style/+page.svelte | 34 ++++++ 6 files changed, 300 insertions(+), 4 deletions(-) create mode 100644 frontend/src/lib/components/search.svelte create mode 100644 frontend/src/lib/components/svg-icon-custom.svelte create mode 100644 frontend/src/lib/css/search.css create mode 100644 frontend/src/lib/css/style.css create mode 100644 frontend/src/routes/style/+page.svelte diff --git a/frontend/src/lib/components/post-min.svelte b/frontend/src/lib/components/post-min.svelte index a1c3aa7..563039d 100644 --- a/frontend/src/lib/components/post-min.svelte +++ b/frontend/src/lib/components/post-min.svelte @@ -14,7 +14,7 @@ export let profile = 'https://i.pravatar.cc/300'; let post_div; - let title_h1; + let title_h1; let cursorX = 0; let cursorY = 0; let updateX = true; @@ -26,12 +26,12 @@ } cursorY = event.clientY - rect.top; post_div.style.backgroundImage = `radial-gradient(circle farthest-corner at ${Math.floor(cursorX)}px ${Math.floor(cursorY)}px, var(--color-background) 0%, #958a98 100%)`; - } + } function animateForeground(isEntering) { const targetOpacity = isEntering ? 1 : 0; - title_h1.style.textDecoration = isEntering ? "underline 3px" : ""; - animation = anime({ + title_h1.style.textDecoration = isEntering ? 'underline 3px' : ''; + anime({ targets: post_div, opacity: [1 - targetOpacity, targetOpacity], duration: 400, diff --git a/frontend/src/lib/components/search.svelte b/frontend/src/lib/components/search.svelte new file mode 100644 index 0000000..b06b1c1 --- /dev/null +++ b/frontend/src/lib/components/search.svelte @@ -0,0 +1,107 @@ + + + + + + +
+ + +
diff --git a/frontend/src/lib/components/svg-icon-custom.svelte b/frontend/src/lib/components/svg-icon-custom.svelte new file mode 100644 index 0000000..90a079d --- /dev/null +++ b/frontend/src/lib/components/svg-icon-custom.svelte @@ -0,0 +1,56 @@ + + + + + + + + + diff --git a/frontend/src/lib/css/search.css b/frontend/src/lib/css/search.css new file mode 100644 index 0000000..775ed9b --- /dev/null +++ b/frontend/src/lib/css/search.css @@ -0,0 +1,49 @@ +.search { + display: flex; + flex-direction: row; + box-shadow: rgba(79, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px; + border-radius: 5rem; +} + +.search input { + padding: 1rem; + background-color: var(--color-background); + font-family: 'JetBrains Mono'; + font-size: 1.2rem; + background-color: #00000000; + color: var(--color-subtext); + border: 0; + width: 100%; + border-top-right-radius: 5rem; + border-bottom-right-radius: 5rem; +} + +.search input:focus { + border: 0; + outline: none; +} + +.search svg { + width: 3rem; + height: auto; + padding: 1rem; + color: var(--color-background); + background-color: var(--color-text); + border-radius: 3rem; + box-shadow: #4f325d40 15px 0px 60px -12px, #0000004d 15px 0px 36px -18px; + background: radial-gradient(circle farthest-corner at 0px 0px, var(--color-subtext) 0%, var(--color-text) 80%); + cursor: pointer; +} + +.search-box { + width: inherit; + height: 16rem; + background-color: var(--color-background); + box-shadow: rgba(79, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px; + border-radius: 1rem; + position: absolute; + z-index: 1; + transform: translateX(-1rem); + display: none; + opacity: 0; +} \ No newline at end of file diff --git a/frontend/src/lib/css/style.css b/frontend/src/lib/css/style.css new file mode 100644 index 0000000..1ac9494 --- /dev/null +++ b/frontend/src/lib/css/style.css @@ -0,0 +1,50 @@ +.base { + margin-left: 3rem; +} + +.blank { + height: 10rem; + background-color: #00000000; +} + +/* Menu */ + +.menu-border { + background-image: -webkit-gradient(linear, right bottom, left bottom, color-stop(0, rgb(52, 42, 58)), color-stop(100, rgb(38, 28, 44))); + background-image: -webkit-linear-gradient(left, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: -moz-linear-gradient(left, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: -o-linear-gradient(left, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: linear-gradient(to left, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + padding: 0.8rem; + width: 40rem; + border-radius: 1rem; + box-shadow: rgba(52, 42, 58, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px; +} + + +.menu { + border-radius: 0.8rem; + background-image: -webkit-gradient(linear, left bottom, right bottom, color-stop(0, rgb(52, 42, 58)), color-stop(100, rgb(38, 28, 44))); + background-image: -webkit-linear-gradient(right, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: -moz-linear-gradient(right, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: -o-linear-gradient(right, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + background-image: linear-gradient(to right, rgb(52, 42, 58) 0%, rgb(38, 28, 44) 100%); + justify-content: center; + align-items: center; + min-height: 10rem; +} + +.menu p { + font-family: 'JetBrains Mono'; + font-weight: 600; + margin: 0 !important; + font-size: 5rem; + color: var(--color-background); + filter: drop-shadow(0px 15px 25px rgba(0, 0, 0, 0.3)) drop-shadow(0px 5px 10px rgba(0, 0, 0, 0.1)); +} + +.menu svg { + margin-right: 3rem; + color: var(--color-background); + filter: drop-shadow(rgba(0, 0, 0, 0.3) 0px 15px 25px) drop-shadow(rgba(0, 0, 0, 0.1) 0px 5px 10px); +} diff --git a/frontend/src/routes/style/+page.svelte b/frontend/src/routes/style/+page.svelte new file mode 100644 index 0000000..9c48de3 --- /dev/null +++ b/frontend/src/routes/style/+page.svelte @@ -0,0 +1,34 @@ + + +
+

+ +
+ +
+ +
+ +
+ +