2023-07-23 01:49:29 +02:00
|
|
|
<script>
|
2023-09-03 18:00:52 +02:00
|
|
|
import { animateIn, getBlurredPath } from '$lib/Helper.mjs'
|
2023-07-23 01:49:29 +02:00
|
|
|
|
|
|
|
/** @type {string}
|
|
|
|
* The path to the image. Usually the file within `static`, but can also be an URL
|
|
|
|
*/
|
|
|
|
export let image
|
|
|
|
/** @type {string | undefined} */
|
|
|
|
export let imageClass = undefined
|
|
|
|
/** @type {string | undefined} */
|
|
|
|
export let containerClass = undefined
|
2023-09-10 18:03:08 +02:00
|
|
|
/** @type {string}
|
|
|
|
* The path to the image. Usually the file within `static`, but can also be an URL
|
|
|
|
*/
|
|
|
|
export let blurredBackground = undefined
|
2023-07-23 01:49:29 +02:00
|
|
|
</script>
|
|
|
|
|
2023-07-31 11:32:19 +02:00
|
|
|
<div class="rice {containerClass} group">
|
2023-09-03 18:00:52 +02:00
|
|
|
<div class="h-full w-full" use:animateIn={{ slide: 20, duration: 800 }}>
|
2023-07-31 11:32:19 +02:00
|
|
|
<img
|
|
|
|
src={image}
|
|
|
|
alt="Rice desktop"
|
2023-09-13 14:27:13 +02:00
|
|
|
class="nice-hover w-full rounded-xl object-cover shadow-2xl hover:scale-[1.01] {imageClass}"
|
2023-07-31 11:32:19 +02:00
|
|
|
/>
|
2023-09-03 18:00:52 +02:00
|
|
|
<div class="rice-blurred">
|
|
|
|
<img
|
2023-09-10 18:03:08 +02:00
|
|
|
src={blurredBackground ?? getBlurredPath(image)}
|
2023-09-03 18:00:52 +02:00
|
|
|
alt="Rice desktop"
|
|
|
|
aria-hidden="true"
|
2023-09-13 14:27:13 +02:00
|
|
|
class="h-full w-full object-cover"
|
|
|
|
loading="lazy"
|
2023-09-03 18:00:52 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2023-07-23 01:49:29 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="postcss">
|
|
|
|
.rice {
|
2023-09-13 14:27:13 +02:00
|
|
|
@apply relative h-auto w-full max-w-[1100px];
|
2023-07-23 01:49:29 +02:00
|
|
|
}
|
|
|
|
.nice-hover {
|
2023-07-31 11:32:19 +02:00
|
|
|
transition: all 540ms cubic-bezier(0.1, -0.81, 0.31, 2);
|
2023-07-23 01:49:29 +02:00
|
|
|
}
|
2023-09-03 18:00:52 +02:00
|
|
|
.rice-blurred {
|
|
|
|
translate: -50% 30%;
|
|
|
|
position: absolute;
|
|
|
|
bottom: -40px;
|
|
|
|
left: 50%;
|
|
|
|
pointer-events: none;
|
|
|
|
width: calc(100% + 120px);
|
|
|
|
height: calc(150% + 120px);
|
|
|
|
opacity: 0.9;
|
|
|
|
/* filter: brightness(2.5); */
|
|
|
|
z-index: -10;
|
|
|
|
mask-image: radial-gradient(50% 50% at 50% 50%, black, transparent);
|
2023-09-07 21:03:47 +02:00
|
|
|
contain: content layout size style;
|
2023-09-03 18:00:52 +02:00
|
|
|
|
|
|
|
@apply -z-10 transition-[filter] duration-500;
|
2023-07-23 01:49:29 +02:00
|
|
|
|
2023-09-07 21:03:47 +02:00
|
|
|
/* Too laggy on firefox */
|
|
|
|
/* .rice:hover & {
|
2023-09-03 18:00:52 +02:00
|
|
|
filter: brightness(4);
|
2023-09-07 21:03:47 +02:00
|
|
|
} */
|
2023-07-23 01:49:29 +02:00
|
|
|
}
|
|
|
|
</style>
|