Skip to content

Commit

Permalink
Add image fade on article
Browse files Browse the repository at this point in the history
  • Loading branch information
Snugug committed Oct 12, 2023
1 parent db49df9 commit 6477159
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion site/en/discover/article.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permalink: '/discover/{{article.title | slugify}}/'

<article class="_discover-article">
<img class="_discover-article--image" src="{{article.bannerImageUrl | deunicode}}" alt="" />
<div class="_discover--inline-container">
<div class="_discover-article--contained">
<div class="_discover-article--container">
<header>
{% if article.iconUrl %}
Expand Down
23 changes: 14 additions & 9 deletions site/sass/discover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
// Article
._discover-article {
$big: calc(80ch + 300px + 11rem);
container-type: inline-size;
$image: calc(50vh - 4rem);

.type {
h2,
Expand Down Expand Up @@ -137,15 +137,21 @@

&--image {
display: block;
height: 33vh;
height: $image;
left: 0;

margin: 0 auto;
object-fit: cover;
position: fixed;
top: 4rem;
width: 100%;
z-index: -1;
}

@container (min-width: calc(80ch + 2px)) {
// Fixed
}
&--contained {
container-type: inline-size;
margin-top: $image;
width: 100%;
}

&--container {
Expand Down Expand Up @@ -173,13 +179,12 @@
}

&::before {
background-image: linear-gradient(to bottom, transparent, var(--white) 33vh);
background-image: linear-gradient(to bottom, transparent 3rem, var(--white) #{$image});
content: '';
height: 100%;
left: -3rem;
// background-color: blue;
left: -25vw;
position: absolute;
width: 100vw;
width: 150vw;
z-index: -1;
}
}
Expand Down

0 comments on commit 6477159

Please sign in to comment.