mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Add base template for website preview route
This commit is contained in:
@@ -22,7 +22,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal:target {
|
.modal:target {
|
||||||
display: block;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal__closeoverlay {
|
.modal__closeoverlay {
|
||||||
@@ -41,12 +44,10 @@
|
|||||||
background-color: var(--bg-primary);
|
background-color: var(--bg-primary);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
border: var(--border-primary);
|
border: var(--border-primary);
|
||||||
|
inline-size: 300px;
|
||||||
|
max-inline-size: 100%;
|
||||||
|
max-block-size: calc(100vh - 2rem);
|
||||||
|
overflow-y: auto;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
position: absolute;
|
|
||||||
max-inline-size: 300px;
|
|
||||||
margin-inline: auto;
|
|
||||||
inset-block-start: 2rem;
|
|
||||||
inset-inline-start: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,10 +3,17 @@
|
|||||||
import markdownit from "markdown-it";
|
import markdownit from "markdown-it";
|
||||||
import hljs from "highlight.js";
|
import hljs from "highlight.js";
|
||||||
|
|
||||||
const { id, title, children, previewContent } = $props<{
|
const {
|
||||||
|
id,
|
||||||
|
title,
|
||||||
|
children,
|
||||||
|
fullPreview = false,
|
||||||
|
previewContent
|
||||||
|
} = $props<{
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
children: Snippet;
|
children: Snippet;
|
||||||
|
fullPreview?: boolean;
|
||||||
previewContent: string;
|
previewContent: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -31,13 +38,18 @@
|
|||||||
<nav class="operations__nav">
|
<nav class="operations__nav">
|
||||||
<a href="/website/{id}">Settings</a>
|
<a href="/website/{id}">Settings</a>
|
||||||
<a href="/website/{id}/articles">Articles</a>
|
<a href="/website/{id}/articles">Articles</a>
|
||||||
|
<a href="/website/{id}/publish">Publish</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{@render children()}
|
{@render children()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
{@html md.render(previewContent)}
|
{#if fullPreview}
|
||||||
|
<iframe src={previewContent} title="Preview"></iframe>
|
||||||
|
{:else}
|
||||||
|
{@html md.render(previewContent)}
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -53,12 +65,8 @@
|
|||||||
|
|
||||||
.operations__nav {
|
.operations__nav {
|
||||||
margin-block: 1rem 2rem;
|
margin-block: 1rem 2rem;
|
||||||
}
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
.operations__nav > a {
|
|
||||||
display: inline-block;
|
|
||||||
padding-inline: 0.5rem;
|
|
||||||
padding-block: 0.25rem;
|
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,4 +75,10 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
inline-size: 100%;
|
||||||
|
block-size: 100%;
|
||||||
|
border: var(--border-primary);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={id} />
|
<input type="hidden" name="id" value={id} />
|
||||||
|
|
||||||
<button type="submit">Permanently delete website</button>
|
<button type="submit">Delete website</button>
|
||||||
</form>
|
</form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
<input type="password" name="password" required />
|
<input type="password" name="password" required />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button type="submit">Permanently delete account</button>
|
<button type="submit">Delete account</button>
|
||||||
</form>
|
</form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Light accent color:
|
Dark accent color:
|
||||||
<input
|
<input
|
||||||
type="color"
|
type="color"
|
||||||
name="accent-color-dark"
|
name="accent-color-dark"
|
||||||
|
|||||||
@@ -50,12 +50,13 @@ export const load = async ({ params, fetch, cookies, url, parent }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const articles = await articlesData.json();
|
const articles = await articlesData.json();
|
||||||
const { website } = await parent();
|
const { website, home } = await parent();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalArticleCount,
|
totalArticleCount,
|
||||||
articles,
|
articles,
|
||||||
website
|
website,
|
||||||
|
home
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={id} />
|
<input type="hidden" name="id" value={id} />
|
||||||
|
|
||||||
<button type="submit">Permanently delete article</button>
|
<button type="submit">Delete article</button>
|
||||||
</form>
|
</form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<WebsiteEditor
|
<WebsiteEditor
|
||||||
id={data.website.id}
|
id={data.website.id}
|
||||||
title={data.website.title}
|
title={data.website.title}
|
||||||
previewContent={data.article.main_content}
|
previewContent={data.article.main_content ||
|
||||||
|
"Put some markdown content in main content to see a live preview here"}
|
||||||
>
|
>
|
||||||
<section>
|
<section>
|
||||||
<h2>Edit article</h2>
|
<h2>Edit article</h2>
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { randomUUID } from "node:crypto";
|
||||||
|
import { mkdir, writeFile } from "node:fs/promises";
|
||||||
|
import { extname, join, relative } from "node:path";
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
|
const { website } = await parent();
|
||||||
|
|
||||||
|
return {
|
||||||
|
website
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
publishWebsite: async ({ fetch }) => {
|
||||||
|
console.log("test");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const generateWebsiteOutput = async () => {};
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { enhance } from "$app/forms";
|
||||||
|
import WebsiteEditor from "$lib/components/WebsiteEditor.svelte";
|
||||||
|
|
||||||
|
const { data } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<WebsiteEditor
|
||||||
|
id={data.website.id}
|
||||||
|
title={data.website.title}
|
||||||
|
previewContent="https://aurora.thilohohlt.com"
|
||||||
|
fullPreview={true}
|
||||||
|
>
|
||||||
|
<section>
|
||||||
|
<h2>Publish website</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The preview area on this page allows you to see exactly how your website will look when it is
|
||||||
|
is published. If you are happy with the results, click the button below and your website will
|
||||||
|
be published on the Internet.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form method="POST" action="?/publishWebsite" use:enhance>
|
||||||
|
<button type="submit">Publish</button>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</WebsiteEditor>
|
||||||
Reference in New Issue
Block a user