Redesign the home page
This commit is contained in:
1 parent
5b32f3dca7
commit
ebb72c7f24
11 files changed
+269
-263
No files matched your search
@@ -0,0 +1,113 @@
|
||||
<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.`,
|
||||
},
|
||||
]
|
||||
|
||||
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>
|
||||
Reference in new issue
Block a user