Fully working side carousel

This commit is contained in:
Yohan Boujon 2024-03-15 16:03:46 +01:00
parent 113584a1ea
commit 36af469f8f
3 changed files with 63 additions and 11 deletions

View file

@ -49,10 +49,27 @@
<div bind:this={movable}> <div bind:this={movable}>
{#each posts as p, index} {#each posts as p, index}
{#if index > 0} {#if index > 0}
<div class="carousel-v-minpost"> <div
class="carousel-v-minpost"
role="button"
tabindex="0"
on:click={() => {
redirectTo(`/article/${p.slug}`);
}}
on:keydown={(event) => handleKeyDown(event, `/article/${p.slug}`)}
>
<img class="carousel-picture" alt="mainpicture" src={p.picture} />
<div class="flex-col align justify-center">
<h2>{p.title}</h2> <h2>{p.title}</h2>
<p>{p.date}</p> <div class="flex align-center margin-horizontal-05">
<p>{p.author}</p> <SvgIcon type="mdi" path={mdiCalendarRange} size="26" />
{p.date}
</div>
<div class="flex align-center margin-horizontal-05">
<SvgIcon type="mdi" path={mdiAccount} size="26" />
{p.author}
</div>
</div>
</div> </div>
{/if} {/if}
{/each} {/each}

View file

@ -1,14 +1,14 @@
.carousel-v-main { .carousel-v-main {
box-shadow: #00000040 0px 8px 18px -1px;
padding: 1rem; padding: 1rem;
margin-left: 15%; margin-left: 10dvw;
width: 70%; width: 80dvw;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 50dvh; height: calc(50dvh + 2rem*3);
font-family: Urbanist; font-family: Urbanist;
font-weight: 500; font-weight: 500;
font-size: 1.1rem; font-size: 1.1rem;
padding-bottom: 3rem;
} }
.carousel-v-bigpost { .carousel-v-bigpost {
@ -16,10 +16,12 @@
width: 50%; width: 50%;
height: 100%; height: 100%;
box-shadow: #00000040 0px 8px 18px -1px; box-shadow: #00000040 0px 8px 18px -1px;
margin: auto;
transition: all .1s ease 0s; transition: all .1s ease 0s;
background-color: var(--color-background); background-color: var(--color-background);
z-index: 2; z-index: 2;
margin-right: 1rem;
margin-top: 2rem;
margin-bottom: 2rem;
} }
.carousel-v-bigpost>div { .carousel-v-bigpost>div {
@ -40,6 +42,10 @@
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 50%;
height: 100%;
padding-top: 2rem;
padding-bottom: 2rem;
} }
.carousel-v-main h2 { .carousel-v-main h2 {
@ -51,7 +57,36 @@
margin-right: 1rem; margin-right: 1rem;
} }
.carousel-v-bigpost:hover { .carousel-v-bigpost:hover, .carousel-v-minpost:hover {
cursor: pointer; cursor: pointer;
transform: scale(1.01) translateY(-4px); transform: scale(1.01) translateY(-4px);
} }
.carousel-v-minpost {
display: flex;
flex-direction: row;
height: calc(50dvh/3);
padding: 1rem;
box-shadow: #00000040 0px 8px 18px -1px;
transition: all .1s ease 0s;
margin-right: 1rem;
margin-left: 1rem;
}
.carousel-v-minpost img {
min-width: 50%;
max-width: 50%;
height: 100%;
object-fit: cover;
margin: 0;
margin-right: 1rem;
}
.carousel-v-minpost h2 {
margin: 0;
margin-bottom: 0.5rem;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}

View file

@ -123,7 +123,7 @@ a {
/* Floating */ /* Floating */
.floating { .floating {
background-color: rgba(248, 241, 241, 0.1); background-color: rgba(248, 241, 241, 0.5);
box-shadow: #41354340 0px 8px 18px -1px; box-shadow: #41354340 0px 8px 18px -1px;
-webkit-backdrop-filter: blur(1rem); -webkit-backdrop-filter: blur(1rem);
backdrop-filter: blur(1rem); backdrop-filter: blur(1rem);