Files
fnx_web/svelte/src/home_page/Showcase.svelte
T

119 lines
2.9 KiB
Svelte
Raw Normal View History

2026-11-05 15:53:24 +01:00
<script lang="ts">
const slides = [
{
image: "download_page",
title: "Download pages",
text: `Share files and directories with a link. Visitors get a fast
download page in your own colours, with your header and background.`,
}, {
image: "access_control",
title: "Access control",
text: `Decide who can read, write and delete, per link, per user and per
password. Passwords double as S3 credentials.`,
}, {
image: "branding",
title: "Branding",
text: `Start from one of the theme presets or pick your own colours,
header image and background image.`,
}, {
image: "image_viewer",
title: "File previews",
text: `Images, videos, audio, PDFs and text files open right in the
browser, and archives can be browsed before downloading.`,
}, {
image: "statistics",
title: "Statistics",
text: `Follow the downloads and data transfer of every file, from the
last day up to five years back.`,
2026-11-09 18:48:27 +01:00
}, {
image: "transfers",
title: "Transfers",
text: `Import from or export to S3, Backblaze B2, Azure, SFTP, FTP,
WebDAV or pixeldrain. Transfers run on our servers, so you can close the
page while they run.`,
2026-11-05 15:53:24 +01:00
},
]
let slider: HTMLDivElement
let current = $state(0)
const show = (i: number) => slider.scrollTo({
left: ((i + slides.length) % slides.length) * slider.clientWidth,
behavior: "smooth",
})
</script>
<div class="page_content showcase">
<div
class="slider"
bind:this={slider}
onscroll={() => current = Math.round(slider.scrollLeft / slider.clientWidth)}
>
{#each slides as slide (slide.image)}
<figure>
<img
src="/res/img/home/{slide.image}.webp"
alt={slide.title}
width="2000"
height="1250"
loading="lazy"
/>
<figcaption>{slide.text}</figcaption>
</figure>
{/each}
</div>
<div class="slider_nav">
<button onclick={() => show(current-1)} title="Previous">
<i class="icon">chevron_left</i>
</button>
{#each slides as slide, i (slide.image)}
<button class:button_highlight={i === current} onclick={() => show(i)}>
{slide.title}
</button>
{/each}
<button onclick={() => show(current+1)} title="Next">
<i class="icon">chevron_right</i>
</button>
</div>
</div>
<style>
/* Lines up with the cards on the home page, which have 4px of padding on each
side */
.showcase {
width: calc(100% - 8px);
max-width: 992px;
margin: 0 auto 12px auto;
padding: 8px;
}
.slider {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
overscroll-behavior-x: contain;
scrollbar-width: none;
}
.slider::-webkit-scrollbar {
display: none;
}
.slider > figure {
flex: 0 0 100%;
margin: 0;
scroll-snap-align: center;
}
.slider img {
display: block;
width: 100%;
height: auto;
border-radius: 6px;
border: 1px solid var(--separator);
}
.slider figcaption {
padding: 0.5em;
text-align: center;
}
.slider_nav {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
</style>