More refactoring!
This commit is contained in:
parent
e368b99775
commit
baa669db8b
11 changed files with 173 additions and 180 deletions
58
src/lib/components/Header.svelte
Normal file
58
src/lib/components/Header.svelte
Normal file
|
@ -0,0 +1,58 @@
|
|||
<script>
|
||||
export let data = '';
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
#logo {
|
||||
|
||||
width: calc(100vw - 20px);
|
||||
|
||||
background: var(--dark-1);
|
||||
|
||||
padding: 5px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
#logo a {
|
||||
padding: 10px;
|
||||
color: var(--light-1);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#logo img {
|
||||
height: 30px;
|
||||
width: auto;
|
||||
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='logo'>
|
||||
<a href='/'>
|
||||
<img src='/icon_sanifae.svg' alt='Sanifae Logo'>
|
||||
</a>
|
||||
{#if data.username && data.username != 'false'}
|
||||
<a href='/user/{data.username}'>
|
||||
{data.username}
|
||||
</a>
|
||||
<a href='/logout'>
|
||||
Log out
|
||||
</a>
|
||||
<a href='/new_post'>
|
||||
Create
|
||||
</a>
|
||||
{:else}
|
||||
<a href='/account'>
|
||||
Log in / Register
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
25
src/lib/components/PostList.svelte
Normal file
25
src/lib/components/PostList.svelte
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script>
|
||||
import Post from '$lib/components/Post.svelte';
|
||||
import Button from '$lib/components/Button.svelte'
|
||||
|
||||
export let data;
|
||||
</script>
|
||||
|
||||
{#if data && data.postJson && data.postJson.data}
|
||||
{#each data.postJson.data as post}
|
||||
<Post
|
||||
success={post.success}
|
||||
username={post.username}
|
||||
content={post.content}
|
||||
upvotes={post.upvotes}
|
||||
downvotes={post.downvotes}
|
||||
id={post.id}
|
||||
isAuthor={post.isAuthor}
|
||||
></Post>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
<Button clickFunc={() => { window.location.search = 'page=' + ((data.id)-1) }}>Previous page</Button>
|
||||
<Button clickFunc={() => { window.location.search = 'page=' + ((data.id)+1) }}>Next page</Button>
|
||||
</p>
|
Loading…
Add table
Add a link
Reference in a new issue