1
0
Fork 0
This commit is contained in:
Leon Grünewald 2024-11-09 00:56:04 +01:00
parent 8c5d490061
commit b55f6e2543
8 changed files with 53 additions and 32 deletions

View file

@ -1,5 +1,4 @@
<script> <script>
import { RangeSlider, Tab, TabGroup, InputChip, SlideToggle } from '@skeletonlabs/skeleton';
import useSettings from '$lib/useSettings.svelte.js'; import useSettings from '$lib/useSettings.svelte.js';
const settings = useSettings(); const settings = useSettings();

View file

@ -28,6 +28,6 @@
</script> </script>
<a {href} class="h-full flex flex-row aspect-square place-content-center justify-center items-center"> <a {href} class="flex flex-row aspect-square place-content-center justify-center items-center bg-gray-600 h-10">
<Fa color="white" size={'2x'} icon={faArrowLeft} /> <Fa color="white" size={'1.5x'} icon={faArrowLeft} />
</a> </a>

View file

@ -17,6 +17,6 @@
loading.set(true); loading.set(true);
onsubmit?.(searchString, true); onsubmit?.(searchString, true);
}}> }}>
<input class="h-10 p-2" type="text" placeholder="Search" bind:value={searchString} /> <input class="h-10 p-2" type="text" placeholder="tags" bind:value={searchString} />
<button class="h-10 p-2 text-white bg-gray-600" type="submit">Submit</button> <button class="h-10 p-2 text-white bg-gray-600" type="submit">Search</button>
</form> </form>

View file

@ -1,13 +1,20 @@
<script> <script>
import {BackAppRailAnchor, GlobalSearch} from "$lib/components"; import {BackButton, GlobalSearch} from "$lib/components";
let {onsubmit = null, back = null, class: className} = $props(); import {faArrowLeft, faCogs} from "@fortawesome/free-solid-svg-icons";
import {Fa} from "svelte-fa";
let {onsubmit = null, back = null, class: className, showSearch = true} = $props();
</script> </script>
<header class="sticky w-full top-0 flex bg-gray-800 py-2 px-4 gap-1 {className}"> <header class="absolute w-full top-0 flex bg-transparent py-2 px-4 gap-1 {className}">
{#if back} {#if back}
<BackAppRailAnchor popCount={back} /> <BackButton popCount={back} />
{/if} {/if}
{#if showSearch}
<GlobalSearch onsubmit={(val = '', explicitRefresh = false) => { <GlobalSearch onsubmit={(val = '', explicitRefresh = false) => {
onsubmit?.(val, explicitRefresh); onsubmit?.(val, explicitRefresh);
}} /> }} />
{/if}
<a href="/settings" class="flex flex-row aspect-square place-content-center justify-center items-center bg-gray-600 h-10">
<Fa color="white" size={'1.5x'} icon={faCogs} />
</a>
</header> </header>

View file

@ -9,16 +9,23 @@
/** @type {Props} */ /** @type {Props} */
let { post = null, class: className} = $props(); let { post = null, class: className} = $props();
let elemRef;
</script> </script>
{#if post?.preview?.has} {#if post?.preview?.has}
<img class:max-h-dvh={settings.limitImageHeight} class={className} src={post.preview.url} alt={`Post ${post.id}`} /> <img class:max-h-dvh={settings.limitImageHeight} class={className} src={post.preview.url} alt={`Post ${post.id}`} />
{:else} {:else}
{#if ['webm', 'mp4'].includes(post.file.ext)} {#if ['webm', 'mp4'].includes(post.file.ext)}
<video class:max-h-dvh={settings.limitImageHeight} class={className} controls playsinline> <video class={className} controls playsinline onclick={async e => {
e.preventDefault();
await e.currentTarget.requestFullscreen();
}}>
<source src={post.file.url} /> <source src={post.file.url} />
</video> </video>
{:else} {:else}
<img class:max-h-dvh={settings.limitImageHeight} class={className} src={post.file.url} alt={`Post ${post.id}`} /> <img class={className} src={post.file.url} alt={`Post ${post.id}`} onclick={async e => {
e.preventDefault();
await e.currentTarget.requestFullscreen();
}}/>
{/if} {/if}
{/if} {/if}

View file

@ -1,5 +1,5 @@
import AppSettings from './AppSettings.svelte'; import AppSettings from './AppSettings.svelte';
import BackAppRailAnchor from './BackButton.svelte'; import BackButton from './BackButton.svelte';
import GlobalSearch from './GlobalSearch.svelte'; import GlobalSearch from './GlobalSearch.svelte';
import ImageGrid from './ImageGrid.svelte'; import ImageGrid from './ImageGrid.svelte';
import PostMedia from './PostMedia.svelte'; import PostMedia from './PostMedia.svelte';
@ -7,7 +7,7 @@ import Header from './Header.svelte';
export { export {
AppSettings, AppSettings,
BackAppRailAnchor, BackButton,
GlobalSearch, GlobalSearch,
ImageGrid, ImageGrid,
PostMedia, PostMedia,

View file

@ -20,7 +20,7 @@
</script> </script>
<div class="grid [grid-template-areas:'header_header_header''main_main_aside']"> <div class="grid [grid-template-areas:'header_header_header''main_main_aside']">
<Header class="[grid-area:header]" back={2} onsubmit={(val = '') => { <Header class="[grid-area:header]" back={2} showSearch={false} onsubmit={(val = '') => {
const queryParams = new URLSearchParams(); const queryParams = new URLSearchParams();
queryParams.set('search', val); queryParams.set('search', val);
goto("/?" + queryParams.toString()) goto("/?" + queryParams.toString())
@ -29,9 +29,7 @@
<main class="[grid-area:main]"> <main class="[grid-area:main]">
{#if post} {#if post}
<div class="flex flex-col"> <div class="flex flex-col">
<section class="flex flex-col place-items-center bg-white"> <PostMedia class="max-h-[95vh] w-auto" {post} />
<PostMedia class="object-contain" {post} />
</section>
<section class="flex flex-row justify-between bg-black"> <section class="flex flex-row justify-between bg-black">
<div class="flex flex-row px-2 gap-2"> <div class="flex flex-row px-2 gap-2">
<button class="py-2 px-3 flex flex-row place-items-center gap-1 text-white hover:text-black hover:bg-white"> <button class="py-2 px-3 flex flex-row place-items-center gap-1 text-white hover:text-black hover:bg-white">

View file

@ -1,2 +1,12 @@
<script></script> <script>
<div></div> import {goto} from "$app/navigation";
import {Header} from "$lib/components/index.js";
</script>
<div class="grid [grid-template-areas:'header_header_header''main_main_aside']">
<Header class="[grid-area:header]" back={2} showSearch={false} onsubmit={(val = '') => {
const queryParams = new URLSearchParams();
queryParams.set('search', val);
goto("/?" + queryParams.toString())
}}></Header>
</div>