From 469aa9c9ab124f9849a32d2f539d9293082426a4 Mon Sep 17 00:00:00 2001 From: Marko OLEKSIYENKO Date: Tue, 12 Sep 2023 12:49:02 +0200 Subject: [PATCH] feat(blog): Set up the basic blog post space --- demo/src/lib/layout/Code.svelte | 13 ++- demo/src/lib/layout/Sample.svelte | 8 -- demo/src/lib/layout/TableOfContents.svelte | 97 ++++++++++++++++++ demo/src/routes/[framework]/+layout.svelte | 79 +------------- demo/src/routes/blog/+page.svelte | 24 +++++ .../yyyy-mm-dd-template/+page.svelte | 64 ++++++++++++ demo/src/routes/blog/blog-preview.svelte | 22 ++++ demo/src/routes/blog/blog-styling.scss | 13 +++ demo/src/routes/blog/blog.model.ts | 7 ++ demo/src/routes/blog/latest.svelte | 26 +++++ demo/static/blog_placeholder.png | Bin 0 -> 11798 bytes 11 files changed, 267 insertions(+), 86 deletions(-) create mode 100644 demo/src/lib/layout/TableOfContents.svelte create mode 100644 demo/src/routes/blog/+page.svelte create mode 100644 demo/src/routes/blog/blog-pages/yyyy-mm-dd-template/+page.svelte create mode 100644 demo/src/routes/blog/blog-preview.svelte create mode 100644 demo/src/routes/blog/blog-styling.scss create mode 100644 demo/src/routes/blog/blog.model.ts create mode 100644 demo/src/routes/blog/latest.svelte create mode 100644 demo/static/blog_placeholder.png diff --git a/demo/src/lib/layout/Code.svelte b/demo/src/lib/layout/Code.svelte index 6e1cc91475..14ef8fa8bb 100644 --- a/demo/src/lib/layout/Code.svelte +++ b/demo/src/lib/layout/Code.svelte @@ -1,4 +1,7 @@ -
+
{#if formattedCode != null}{@html formattedCode}{:else}{code}{/if}
+
+ +
diff --git a/demo/src/routes/[framework]/+layout.svelte b/demo/src/routes/[framework]/+layout.svelte index 1b34df6086..d36d63fc3c 100644 --- a/demo/src/routes/[framework]/+layout.svelte +++ b/demo/src/routes/[framework]/+layout.svelte @@ -3,31 +3,9 @@ import 'bootstrap/dist/css/bootstrap.css'; import {pathToRoot$, selectedFramework$, intersectionApi} from '../../lib/stores'; import {menu} from '../navigation'; + import TableOfContents from '$lib/layout/TableOfContents.svelte'; const {elements$, visibleElements$} = intersectionApi; - function getElementProperties(element: HTMLElement, isVisible: boolean) { - const header = element.querySelector('h1,h2,h3') as HTMLElement; - if (header) { - const classnames = [`toc-link d-inline-block toc-${header.tagName.toLowerCase()}`]; - - const firstSubSection = element.querySelector('section'); - if ((firstSubSection && visibleElements$().has(firstSubSection)) || (!firstSubSection && isVisible)) { - classnames.push('active'); - } - - return { - label: header.innerText, - href: header.querySelector('a')?.getAttribute('href') ?? '', - classname: classnames.join(' '), - }; - } else { - return { - label: '', - href: '', - classname: '', - }; - } - }
@@ -60,24 +38,7 @@
-
- {#if $elements$.length} -
-
On this page
- -
- {/if} -
+
diff --git a/demo/src/routes/blog/+page.svelte b/demo/src/routes/blog/+page.svelte new file mode 100644 index 0000000000..f175c1e4d4 --- /dev/null +++ b/demo/src/routes/blog/+page.svelte @@ -0,0 +1,24 @@ + + + +
+ {#each blogs as blog} +
+ +
+ {/each} +
diff --git a/demo/src/routes/blog/blog-pages/yyyy-mm-dd-template/+page.svelte b/demo/src/routes/blog/blog-pages/yyyy-mm-dd-template/+page.svelte new file mode 100644 index 0000000000..b3aad96446 --- /dev/null +++ b/demo/src/routes/blog/blog-pages/yyyy-mm-dd-template/+page.svelte @@ -0,0 +1,64 @@ + + + + Blog post example + + + +
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas lobortis dolor quis dui condimentum, ut pharetra velit lobortis. Mauris a + elementum metus. Sed lacinia nisi eu diam venenatis porttitor. Morbi arcu nunc, efficitur vitae sem sed, commodo pulvinar tellus. Donec eu ipsum + consequat, mollis nibh at, pharetra tortor. Fusce sit amet lacus ac mi bibendum molestie a sed ante. In quis justo lorem. Phasellus placerat, + dolor at eleifend iaculis, lorem augue vestibulum risus, a fermentum libero augue vitae sem. Quisque porta turpis nec fermentum consequat. + Suspendisse vel molestie est. Aliquam mollis, nibh a iaculis sollicitudin, massa eros pulvinar massa, in rhoncus lectus nisl at nisi. + Suspendisse euismod vulputate turpis vitae tristique. Aenean tincidunt enim quis ante pellentesque imperdiet. + + +
+ +
+ Quisque molestie lacinia justo eget pharetra. Phasellus et metus mattis libero consequat vestibulum. Nam vitae dignissim sem, eu egestas libero. + Quisque fringilla quis ex vitae auctor. Nullam enim mi, posuere nec tempus a, tristique vel nisi. Nulla volutpat turpis eget turpis tempor + scelerisque. Nunc nec vehicula elit, at molestie nisi. +
+ +
+ In a ante vehicula felis ullamcorper sagittis. Sed dignissim mi sit amet magna vulputate rutrum. Donec pretium rhoncus posuere. Sed sit amet + erat quam. Mauris eu nulla pharetra, malesuada quam non, vestibulum erat. Sed malesuada elit eu tellus elementum, quis congue dui lacinia. Donec + facilisis erat purus, nec ornare sapien aliquet eget. Aliquam erat volutpat. Duis a eros magna. Donec varius neque non dignissim feugiat. Nullam + pellentesque egestas tempor. Maecenas accumsan turpis est, eu efficitur ex tempor posuere. Nam interdum aliquam nibh, eu ultrices velit pharetra + in. Etiam vitae urna hendrerit nisi ornare imperdiet eget in nisl. +
+
+ + +
diff --git a/demo/src/routes/blog/blog-preview.svelte b/demo/src/routes/blog/blog-preview.svelte new file mode 100644 index 0000000000..46936de07f --- /dev/null +++ b/demo/src/routes/blog/blog-preview.svelte @@ -0,0 +1,22 @@ + + +
+ +
+ {blogPost.author} + {blogPost.publishDate} +
+
diff --git a/demo/src/routes/blog/blog-styling.scss b/demo/src/routes/blog/blog-styling.scss new file mode 100644 index 0000000000..bf55253286 --- /dev/null +++ b/demo/src/routes/blog/blog-styling.scss @@ -0,0 +1,13 @@ +.blog-preview { + width: 100%; + object-fit: contain; +} + +a.blog-link { + color: inherit !important; + text-decoration: none !important; +} + +img { + border: 1px solid gray; +} diff --git a/demo/src/routes/blog/blog.model.ts b/demo/src/routes/blog/blog.model.ts new file mode 100644 index 0000000000..d93392944b --- /dev/null +++ b/demo/src/routes/blog/blog.model.ts @@ -0,0 +1,7 @@ +export interface BlogPost { + header: string; + shortDescription: string; + author: string; + publishDate: string; + href: string; +} diff --git a/demo/src/routes/blog/latest.svelte b/demo/src/routes/blog/latest.svelte new file mode 100644 index 0000000000..aaec248113 --- /dev/null +++ b/demo/src/routes/blog/latest.svelte @@ -0,0 +1,26 @@ + + +
+
+ + Blog placeholder + +
+
+ +
+

{blogPost.author}

+

{blogPost.publishDate}

+
+
+
diff --git a/demo/static/blog_placeholder.png b/demo/static/blog_placeholder.png new file mode 100644 index 0000000000000000000000000000000000000000..bb1655c7e6ab1ede859ba5463401dd3f96ee1ec6 GIT binary patch literal 11798 zcmeHN2{@E%-+ye89I`Jdj;w=O>_aF_Wf{T@*)z;!$yjCvQBBLyF_tL4jLZ>m>5NgNeKYf`v4n6uqO@xkVpUo000NT$|MG`F=|YVpB~e$Z}o#r@&LFGryuO+>gJ6lN@B3bJ@LA7 zQxB@-Bt6}Agd_|KhC$^RBmwR?Z7ZXLUnm$? zx^iD^4GIbZ2dRR61CB#ra5x+SRe`9eC^Hbsgp+upYp^n&u$RHWDY?mEgeABIc={1N zeeseToURyO5>Z!9j#KgrHPI9I2lqedu+g(A1cOada^J?KwiTA(dxEsVhQ@mm^;Gsj z{#Elg_|ZS`da6(;1oj30=k{-4yZ;9K=XQoykPSEf7Ou2VcL=xsMOz zv$vaAZ6jYdk`ES7G&a)vJcaJQZl3Pi1fs8-x3-3smbw~DO+y*OI4P^S!&H=A;V?C2 z7!;<8!D`^J8W_wz$UhNn`1`rh7*8O&;@z+ec18o(lfkU%235nVz%j~jcc`1P8b$@C ztfi@?uB-)x!QiSI>aL8Iubh9n{a?!RSt&*kF~SM*EhsnU^50*64DwwX|B&m4T;HX@ zcY%LI*AKbAOM&kK|A?+1a($Nq-v$1E6kUI$6IeVWhX`UM3+vs0A;8AM%F4>Z#yGIC zv2A1L;$UYKo*g^3bMf-<@$vHT^70Fb3-b$z3G(ua{4652d$)vy1i!G9wA3DH@jViI z)_(_fa4>l=b2BmV0_#tJ-Hb#FU}j+?Tc2|z#*u@Kon_m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