From d5407181a4341e8f28d31e24360059e2e92c26ff Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 17 Apr 2021 16:08:13 +0800 Subject: [PATCH] Add shadow effect option for images --- _posts/2019-08-08-text-and-typography.md | 6 +++++- _posts/2019-08-08-write-a-new-post.md | 11 ++++++++++- _sass/addon/commons.scss | 22 +++++++++++----------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/_posts/2019-08-08-text-and-typography.md b/_posts/2019-08-08-text-and-typography.md index fa267ea..53b48ab 100644 --- a/_posts/2019-08-08-text-and-typography.md +++ b/_posts/2019-08-08-text-and-typography.md @@ -57,7 +57,6 @@ Fluttering and dancing in the breeze. - [ ] TODO - [x] Completed -- Hold on - [ ] Defeat COVID-19 - [x] Vaccine production - [ ] Economic recovery @@ -108,6 +107,11 @@ _Full screen width and center alignment_ ![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="400"} _400px image width_ +- Shadow + +![Shadow Avatar](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="90%" } +_shadow effect (visible in light mode)_ +
- Left aligned diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index 15567df..97b25d4 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -135,7 +135,16 @@ By default, the image is centered, but you can specify the position by using one ![Desktop View](/assets/img/sample/mockup.png){: .right} ``` -**Limitation**: Once you specify the position of an image, it is forbidden to add the image caption. +> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption. + +### Image shadow + +The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode: + +```markdown +![Desktop View](/assets/img/sample/mockup.png){: .shadow} +``` + ### CDN URL diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 4d168a5..6376dbe 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -363,10 +363,6 @@ footer { overflow-wrap: break-word; word-wrap: break-word; - img[data-src] { - margin: 0.5rem 0; - } - @mixin img-caption { + em { display: block; @@ -378,9 +374,11 @@ footer { } } - @mixin img($caption: false) { + @mixin img-style($caption: false) { + + img[data-src] { + margin: 0.5rem 0; - > img[data-src] { @if $caption { @include img-caption; } @@ -395,9 +393,15 @@ footer { margin: 0.75rem 0 1rem 1rem; } + &.shadow { + filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08)); + } + } } + @include img-style(true); + a { blockquote & { color: var(--link-color); @@ -412,7 +416,7 @@ footer { } &.img-link { - @include img; + @include img-style; @include img-caption; } } @@ -423,10 +427,6 @@ footer { } } - p { - @include img(true); - } - ul { // attribute 'hide-bullet' was added by liquid .task-list-item[hide-bullet] {