mirror of
https://github.com/danbulant/design
synced 2026-07-05 11:00:38 +00:00
more animations
This commit is contained in:
parent
637b7c0f43
commit
34acfec281
3 changed files with 37 additions and 29 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
$: dt = DateTime.fromISO(date);
|
$: dt = DateTime.fromISO(date);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href={path} class="post">
|
<a href={path} class="post select-none cursor-pointer hover:no-underline transform transition duration-300 active:scale-95 block">
|
||||||
{#if bigThumbnail}
|
{#if bigThumbnail}
|
||||||
<img src={bigThumbnail} styles="width: 800px; height: 400px;" alt="Thumbnail" class="thumbnail" draggable={false}>
|
<img src={bigThumbnail} styles="width: 800px; height: 400px;" alt="Thumbnail" class="thumbnail" draggable={false}>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
@ -38,13 +38,6 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.post {
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
a.post:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
$: dt = DateTime.fromISO(date);
|
$: dt = DateTime.fromISO(date);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href={path} class:dark={$darkmode} class="post" class:grayscale on:mouseenter={mouseenter} on:mouseleave={mouseleave}>
|
<a href={path} class:dark={$darkmode} class="post transition duration-300 block transform active:scale-95" class:grayscale on:mouseenter={mouseenter} on:mouseleave={mouseleave}>
|
||||||
{#if thumbnail}
|
{#if thumbnail}
|
||||||
<img src={thumbnail} alt="Thumbnail" class="thumbnail" draggable={false}>
|
<img src={thumbnail} alt="Thumbnail" class="thumbnail" draggable={false}>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
@ -58,7 +58,6 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.post {
|
.post {
|
||||||
transition: filter .3s;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { goatCounter } from "$lib/goatcounter";
|
import { goatCounter } from "$lib/goatcounter";
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from "$app/navigation";
|
||||||
export var image; // "https://picsum.photos/725/350?random=" + Math.floor(Math.random() * 5000);
|
export var image; // "https://picsum.photos/725/350?random=" + Math.floor(Math.random() * 5000);
|
||||||
export var link = "";
|
export var link = "";
|
||||||
export var grayscale = false;
|
export var grayscale = false;
|
||||||
|
|
@ -9,28 +9,52 @@
|
||||||
export var crossfadesend = null;
|
export var crossfadesend = null;
|
||||||
export var crossfadereceive = null;
|
export var crossfadereceive = null;
|
||||||
export var crossfadekey = null;
|
export var crossfadekey = null;
|
||||||
export var target="_blank";
|
export var target = "_blank";
|
||||||
export var width;
|
export var width;
|
||||||
export var height;
|
export var height;
|
||||||
export var name;
|
export var name;
|
||||||
function handle(e) {
|
function handle(e) {
|
||||||
if(!link) {
|
if (!link) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
alert("No link available");
|
alert("No link available");
|
||||||
} else if(link.startsWith("/")) {
|
} else if (link.startsWith("/")) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
goto(link);
|
goto(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href={link || "#"} {target} rel="noopener" data-goatcounter-click="project-{name}" class="full" on:click={handle} use:goatCounter>
|
<a
|
||||||
|
href={link || "#"}
|
||||||
|
{target}
|
||||||
|
rel="noopener"
|
||||||
|
data-goatcounter-click="project-{name}"
|
||||||
|
class="w-full hover:no-underline block transition duration-300 active:scale-95 transform"
|
||||||
|
on:click={handle}
|
||||||
|
use:goatCounter
|
||||||
|
>
|
||||||
<div class="project">
|
<div class="project">
|
||||||
<div class="imgcon">
|
<div class="imgcon">
|
||||||
{#if crossfadesend}
|
{#if crossfadesend}
|
||||||
<img out:crossfadesend={{ key: crossfadekey }} in:crossfadereceive={{ key: crossfadekey }} src={image} alt={name} draggable={false} class:grayscale {width} {height}>
|
<img
|
||||||
|
out:crossfadesend={{ key: crossfadekey }}
|
||||||
|
in:crossfadereceive={{ key: crossfadekey }}
|
||||||
|
src={image}
|
||||||
|
alt={name}
|
||||||
|
draggable={false}
|
||||||
|
class:grayscale
|
||||||
|
{width}
|
||||||
|
{height}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<img src={image} alt={name} draggable={false} class:grayscale {width} {height}>
|
<img
|
||||||
|
src={image}
|
||||||
|
alt={name}
|
||||||
|
draggable={false}
|
||||||
|
class:grayscale
|
||||||
|
{width}
|
||||||
|
{height}
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $$slots.desc}
|
{#if $$slots.desc}
|
||||||
<div class="desc" class:extradark>
|
<div class="desc" class:extradark>
|
||||||
|
|
@ -42,24 +66,16 @@
|
||||||
</div>
|
</div>
|
||||||
<h3><slot /></h3>
|
<h3><slot /></h3>
|
||||||
{#if clickable}
|
{#if clickable}
|
||||||
<div class="clickable">
|
<div class="clickable">Click to view details</div>
|
||||||
Click to view details
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
a.full:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.project {
|
.project {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
a.full {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.imgcon {
|
.imgcon {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
|
@ -85,7 +101,7 @@
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
.desc.extradark {
|
.desc.extradark {
|
||||||
background-color: rgba(0,0,0,0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
.desc .content {
|
.desc .content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
@ -94,7 +110,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
transition: filter .3s;
|
transition: filter 0.3s;
|
||||||
filter: blur(0px) grayscale(0);
|
filter: blur(0px) grayscale(0);
|
||||||
}
|
}
|
||||||
img.grayscale {
|
img.grayscale {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue