From 59845e4e54756e9e5b910efa8cab501fbbe229cb Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Sun, 4 Aug 2024 00:41:16 +0100 Subject: [PATCH] Added Archive element. --- frontend/src/lib/components/archive.svelte | 145 +++++++++++++++++++++ frontend/src/lib/components/search.svelte | 2 +- frontend/src/lib/css/archive.css | 48 +++++++ frontend/src/routes/style/+page.svelte | 7 +- 4 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 frontend/src/lib/components/archive.svelte create mode 100644 frontend/src/lib/css/archive.css diff --git a/frontend/src/lib/components/archive.svelte b/frontend/src/lib/components/archive.svelte new file mode 100644 index 0000000..08ebbac --- /dev/null +++ b/frontend/src/lib/components/archive.svelte @@ -0,0 +1,145 @@ + + +
+ + {#each Object.keys(posts) as date, index} + +
{ + if (indexArchive != -1 && indexArchive != index) { + toggleArchive(date, indexArchive); + } + toggleArchive(date, index); + }} + > + {date} + +
+
+ {#each posts[date] as p} +
+ {p} +
+ {/each} +
+ {/each} +
diff --git a/frontend/src/lib/components/search.svelte b/frontend/src/lib/components/search.svelte index b06b1c1..a1db255 100644 --- a/frontend/src/lib/components/search.svelte +++ b/frontend/src/lib/components/search.svelte @@ -3,7 +3,7 @@ import '$lib/css/search.css'; import SvgIcon from '$lib/components/svg-icon-custom.svelte'; - import { mdiContentSavePlusOutline, mdiMagnify } from '@mdi/js'; + import { mdiMagnify } from '@mdi/js'; import anime from 'animejs'; let div_search; diff --git a/frontend/src/lib/css/archive.css b/frontend/src/lib/css/archive.css new file mode 100644 index 0000000..e47ca43 --- /dev/null +++ b/frontend/src/lib/css/archive.css @@ -0,0 +1,48 @@ +.archive-container { + box-shadow: rgba(52, 42, 58, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px; + /* For now */ + width: 50%; + border-radius: 1rem; + color: var(--color-text); +} + +.archive { + font-family: 'JetBrains Mono'; + font-size: 1.2rem; + padding: 1rem; + display: flex; + flex-direction: row; + justify-content: space-between; + cursor: pointer; + border-radius: 1rem; +} + +.archive-post { + font-family: 'JetBrains Mono'; + font-size: var(--font-post); + padding-left: 1rem; + color: var(--color-subtext); + opacity: 0; + height: 0px; + display: none; +} + +.archive-post span { + /* Overflow */ + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + text-overflow: ellipsis; + -webkit-line-clamp: 1; + line-clamp: 1; +} + +.archive-post span:hover { + color: var(--palette-pink); + text-decoration: underline 2px; + cursor: pointer; +} + +.archive-post div { + padding: var(--padding-post); +} \ No newline at end of file diff --git a/frontend/src/routes/style/+page.svelte b/frontend/src/routes/style/+page.svelte index 9c48de3..2df61a8 100644 --- a/frontend/src/routes/style/+page.svelte +++ b/frontend/src/routes/style/+page.svelte @@ -6,6 +6,7 @@ import Post from '$lib/components/post-min.svelte'; import Search from '$lib/components/search.svelte'; + import Archive from '$lib/components/archive.svelte';
@@ -26,9 +27,11 @@ date="26/07/2024" />
- -
+
+ +
+