added some css

This commit is contained in:
Djeeberjr 2022-05-10 23:19:31 +02:00
parent a11349e456
commit 3c5d62f86d
4 changed files with 55 additions and 17 deletions

View File

@ -13,13 +13,13 @@
contentType = res.headers.get("Content-Type"); contentType = res.headers.get("Content-Type");
let m; let match;
while ((m = regex.exec(res.headers.get("Content-Disposition"))) !== null) { while ((match = regex.exec(res.headers.get("Content-Disposition"))) !== null) {
// This is necessary to avoid infinite loops with zero-width matches // This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) { if (match.index === regex.lastIndex) {
regex.lastIndex++; regex.lastIndex++;
} }
filename = m[1]; filename = match[1];
} }
document.title = filename; document.title = filename;
@ -29,19 +29,24 @@
</script> </script>
<main> <main>
<div>{slug}</div> {#if component === null}
<div> Loading data...
{#if component === null} {:else}
{#await component}
Loading data... Loading data...
{:else} {:then v }
{#await component} <svelte:component this={v.default} slug={slug} contentType={contentType} filename={filename} />
Loading data... {/await}
{:then v } {/if}
<svelte:component this={v.default} slug={slug} contentType={contentType} filename={filename} />
{/await}
{/if}
</div>
</main> </main>
<style> <style>
main {
display: flex;
justify-content: center;
margin-top: 5rem;
}
</style> </style>

4
web/index.css Normal file
View File

@ -0,0 +1,4 @@
body {
background-color: #0d1117;
font-family: sans-serif;
}

View File

@ -1,4 +1,5 @@
import App from "./App.svelte"; import App from "./App.svelte";
import "./index.css";
const app = new App({ const app = new App({
target: document.body, target: document.body,

View File

@ -12,7 +12,35 @@ import { onMount } from "svelte";
}); });
</script> </script>
<div> <div class="container" >
Text opener <header>{filename}</header>
<pre><code>{ content }</code></pre> <pre><code>{ content }</code></pre>
</div> </div>
<style>
code{
color: #c9d1d9;
}
pre{
padding: 1rem;
}
header{
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 1rem;
color: #58a6ff;
border-bottom: solid 1px #1f6feb;
padding: 1rem;
}
.container{
border-width: 2px;
border-color: #1f6feb;
border-style: solid;
border-radius: 5px;
}
</style>