From 2fd22b6039b1c10b362b976393dd2e7501cf065e Mon Sep 17 00:00:00 2001 From: buttercat1791 Date: Thu, 4 Jul 2024 16:54:10 -0500 Subject: Article styles and layout --- package.json | 33 ++++++++-------- pnpm-lock.yaml | 8 ++++ src/app.css | 49 ++++++++++++++++------- src/lib/Article.svelte | 75 ++++++++++++++++++++++++------------ src/lib/ArticleHeader.svelte | 2 +- src/lib/components/Navigation.svelte | 6 +-- tailwind.config.cjs | 24 ++++++------ 7 files changed, 128 insertions(+), 69 deletions(-) diff --git a/package.json b/package.json index e080269..ae838af 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "nostrwiki", "version": "0.0.1", "private": true, + "type": "module", "scripts": { "dev": "vite dev", "build": "vite build", @@ -11,10 +12,26 @@ "lint": "prettier --plugin-search-dir . --check . && eslint .", "format": "prettier --plugin-search-dir . --write ." }, + "dependencies": { + "@nostr-dev-kit/ndk": "^2.3.3", + "@nostr-dev-kit/ndk-cache-dexie": "^2.2.4", + "@popperjs/core": "^2.11.8", + "@sveltejs/vite-plugin-svelte": "^3.0.1", + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.10", + "markdown-it": "^14.0.0", + "markdown-it-plain-text": "^0.3.0", + "marked": "^11.1.1", + "nostr-tools": "^2.1.4", + "showdown": "^2.1.0", + "svelte-add": "2023.12.16-0.0", + "tailwind-merge": "^2.2.1" + }, "devDependencies": { "@sveltejs/adapter-auto": "^3.1.1", "@sveltejs/kit": "^2.4.3", "@types/markdown-it": "^13.0.7", + "@types/showdown": "^2.0.6", "autoprefixer": "^10.4.17", "eslint-plugin-svelte": "^2.35.1", "flowbite": "^2.2.1", @@ -30,21 +47,5 @@ "tslib": "^2.6.2", "typescript": "^5.3.3", "vite": "^5.0.12" - }, - "type": "module", - "dependencies": { - "@nostr-dev-kit/ndk": "^2.3.3", - "@nostr-dev-kit/ndk-cache-dexie": "^2.2.4", - "@popperjs/core": "^2.11.8", - "@sveltejs/vite-plugin-svelte": "^3.0.1", - "@tailwindcss/forms": "^0.5.7", - "@tailwindcss/typography": "^0.5.10", - "markdown-it": "^14.0.0", - "markdown-it-plain-text": "^0.3.0", - "marked": "^11.1.1", - "nostr-tools": "^2.1.4", - "showdown": "^2.1.0", - "svelte-add": "2023.12.16-0.0", - "tailwind-merge": "^2.2.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa4c7e6..6597df2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,6 +57,9 @@ importers: '@types/markdown-it': specifier: ^13.0.7 version: 13.0.7 + '@types/showdown': + specifier: ^2.0.6 + version: 2.0.6 autoprefixer: specifier: ^10.4.17 version: 10.4.17(postcss@8.4.33) @@ -507,6 +510,9 @@ packages: '@types/pug@2.0.10': resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} + '@types/showdown@2.0.6': + resolution: {integrity: sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==} + '@typescript-eslint/types@6.21.0': resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -2316,6 +2322,8 @@ snapshots: '@types/pug@2.0.10': {} + '@types/showdown@2.0.6': {} + '@typescript-eslint/types@6.21.0': {} '@typescript-eslint/typescript-estree@6.21.0(typescript@5.3.3)': diff --git a/src/app.css b/src/app.css index bd62417..38d0653 100644 --- a/src/app.css +++ b/src/app.css @@ -5,16 +5,16 @@ @layer components { /* General */ .leather { - @apply bg-primary-1000 dark:bg-primary-0; + @apply bg-primary-0 dark:bg-primary-1000 text-gray-800 dark:text-gray-300; } /* Button */ button.btn-leather.text-white { - @apply text-primary-1000; + @apply text-primary-0; } .btn-leather span svg { - @apply fill-gray-700 hover:fill-primary-400 dark:fill-gray-400 dark:hover:fill-primary-700; + @apply fill-gray-800 hover:fill-primary-400 dark:fill-gray-300 dark:hover:fill-primary-500; } .btn-leather.text-xs { @@ -35,7 +35,7 @@ /* Card */ div.card-leather { - @apply bg-primary-1000 dark:bg-primary-0 border-gray-200 has-[:hover]:border-primary-400 dark:border-gray-700 dark:has-[:hover]:border-primary-700; + @apply bg-primary-0 dark:bg-primary-1000 border-gray-200 has-[:hover]:border-primary-800 dark:border-gray-800 dark:has-[:hover]:border-primary-500; } div.card-leather h1, @@ -44,12 +44,26 @@ div.card-leather h4, div.card-leather h5, div.card-leather h6 { - @apply text-gray-700 hover:text-primary-400 dark:text-gray-400 dark:hover:text-primary-700; + @apply text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500; + } + + /* Content */ + div.note-leather { + @apply bg-primary-0 dark:bg-primary-1000 text-gray-800 dark:text-gray-300 hover:bg-primary-100 dark:hover:bg-primary-800 p-2 rounded; + } + + /* Heading */ + h1.h-leather, + h2.h-leather, + h3.h-leather, + h4.h-leather, + h5.h-leather { + @apply text-gray-800 dark:text-gray-300; } /* Modal */ div.modal-leather > div { - @apply bg-primary-1000 dark:bg-primary-0 border-b-[1px] border-gray-700 dark:border-gray-400; + @apply bg-primary-0 dark:bg-primary-1000 border-b-[1px] border-gray-800 dark:border-gray-500; } div.modal-leather > div > h1, @@ -58,20 +72,20 @@ div.modal-leather > div > h4, div.modal-leather > div > h5, div.modal-leather > div > h6 { - @apply text-gray-700 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-400; + @apply text-gray-800 hover:text-gray-800 dark:text-gray-300 dark:hover:text-gray-300; } div.modal-leather button { - @apply bg-primary-1000 hover:bg-primary-1000 dark:bg-primary-0 dark:hover:bg-primary-0 text-gray-700 hover:text-primary-400 dark:text-gray-400 dark:hover:text-primary-700; + @apply bg-primary-0 hover:bg-primary-0 dark:bg-primary-1000 dark:hover:bg-primary-1000 text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500; } /* Navbar */ nav.navbar-leather { - @apply bg-primary-1000 dark:bg-primary-0; + @apply bg-primary-0 dark:bg-primary-1000; } nav.navbar-leather svg { - @apply fill-gray-700 hover:fill-primary-400 dark:fill-gray-400 dark:hover:fill-primary-700; + @apply fill-gray-800 hover:fill-primary-400 dark:fill-gray-300 dark:hover:fill-primary-500; } nav.navbar-leather h1, @@ -80,16 +94,25 @@ nav.navbar-leather h4, nav.navbar-leather h5, nav.navbar-leather h6 { - @apply text-gray-700 hover:text-primary-400 dark:text-gray-400 dark:hover:text-primary-700; + @apply text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500; + } + + /* Sidebar */ + aside.sidebar-leather > div { + @apply bg-gray-100 dark:bg-gray-900; + } + + a.sidebar-item-leather { + @apply hover:bg-primary-100 dark:hover:bg-primary-800; } /* Tooltip */ div.tooltip-leather { - @apply text-gray-700 dark:text-gray-400; + @apply text-gray-800 dark:text-gray-300; } /* Unordered list */ .ul-leather li a { - @apply text-gray-700 hover:text-primary-400 dark:text-gray-400 dark:hover:text-primary-700; + @apply text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500; } } diff --git a/src/lib/Article.svelte b/src/lib/Article.svelte index e61a5bd..55839f8 100644 --- a/src/lib/Article.svelte +++ b/src/lib/Article.svelte @@ -1,46 +1,73 @@ -{#await getEvents() then article} - +{#await getEvents()} + + + + + + +{:then events} + + + {#each events as event} {/each} - +
+ {#each events as event} +
+ {event.getMatchingTags('title')[0][1]} + {@html converter.makeHtml(event.content)} +
+ {/each} +
{/await}