mirror of
https://github.com/danbulant/design
synced 2026-07-07 20:10:45 +00:00
improved post styles
This commit is contained in:
parent
a33b416d50
commit
15384d2aa6
3 changed files with 29 additions and 5 deletions
|
|
@ -29,6 +29,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.post {
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,20 @@
|
||||||
export var date;
|
export var date;
|
||||||
export var title;
|
export var title;
|
||||||
export var authorIcon;
|
export var authorIcon;
|
||||||
|
export var currentHover;
|
||||||
|
|
||||||
|
var grayscale = false;
|
||||||
|
$: grayscale = currentHover && currentHover !== title;
|
||||||
|
|
||||||
|
function mouseenter() {
|
||||||
|
currentHover = title;
|
||||||
|
}
|
||||||
|
function mouseleave() {
|
||||||
|
if(currentHover == title) currentHover = null;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="post">
|
<div class="post" class:grayscale on:mouseenter={mouseenter} on:mouseleave={mouseleave}>
|
||||||
<img src={thumbnail} alt="Thumbnail" class="thumbnail" draggable={false}>
|
<img src={thumbnail} alt="Thumbnail" class="thumbnail" draggable={false}>
|
||||||
<div class="data">
|
<div class="data">
|
||||||
<div class="categories">
|
<div class="categories">
|
||||||
|
|
@ -27,10 +38,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.grayscale {
|
||||||
|
filter: grayscale(100%) blur(2px);
|
||||||
|
}
|
||||||
.post {
|
.post {
|
||||||
|
transition: filter .3s;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
margin: 10px 0;
|
padding: 10px 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@
|
||||||
categories: ["test"],
|
categories: ["test"],
|
||||||
date: "16-01-2021"
|
date: "16-01-2021"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
var currentHover = null;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2>Posts</h2>
|
<h2>Posts</h2>
|
||||||
|
|
@ -49,8 +51,8 @@
|
||||||
<HeroPost {...heroPost} />
|
<HeroPost {...heroPost} />
|
||||||
</div>
|
</div>
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{#each posts as post}
|
{#each posts as post (post.title)}
|
||||||
<Post {...post} />
|
<Post {...post} bind:currentHover />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -64,9 +66,10 @@
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
h2 {
|
h2 {
|
||||||
font-weight: 400;
|
font-weight: 500;
|
||||||
max-width: 1360px;
|
max-width: 1360px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
.hero {
|
.hero {
|
||||||
width: calc(60% - 5px);
|
width: calc(60% - 5px);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue