Skip to content

Commit 6d56bd5

Browse files
committed
Add shadow effect option for images
1 parent 8cbec5c commit 6d56bd5

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

_posts/2019-08-08-text-and-typography.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Fluttering and dancing in the breeze.
5757

5858
- [ ] TODO
5959
- [x] Completed
60-
- Hold on
6160
- [ ] Defeat COVID-19
6261
- [x] Vaccine production
6362
- [ ] Economic recovery
@@ -108,6 +107,11 @@ _Full screen width and center alignment_
108107
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="400"}
109108
_400px image width_
110109

110+
- Shadow
111+
112+
![Shadow Avatar](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="90%" }
113+
_shadow effect (visible in light mode)_
114+
111115
<br>
112116

113117
- Left aligned

_posts/2019-08-08-write-a-new-post.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,16 @@ By default, the image is centered, but you can specify the position by using one
135135
![Desktop View](/assets/img/sample/mockup.png){: .right}
136136
```
137137

138-
**Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
138+
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
139+
140+
### Image shadow
141+
142+
The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode:
143+
144+
```markdown
145+
![Desktop View](/assets/img/sample/mockup.png){: .shadow}
146+
```
147+
139148

140149
### CDN URL
141150

_sass/addon/commons.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@ footer {
363363
overflow-wrap: break-word;
364364
word-wrap: break-word;
365365

366-
img[data-src] {
367-
margin: 0.5rem 0;
368-
}
369-
370366
@mixin img-caption {
371367
+ em {
372368
display: block;
@@ -378,9 +374,11 @@ footer {
378374
}
379375
}
380376

381-
@mixin img($caption: false) {
377+
@mixin img-style($caption: false) {
378+
379+
img[data-src] {
380+
margin: 0.5rem 0;
382381

383-
> img[data-src] {
384382
@if $caption {
385383
@include img-caption;
386384
}
@@ -395,9 +393,15 @@ footer {
395393
margin: 0.75rem 0 1rem 1rem;
396394
}
397395

396+
&.shadow {
397+
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
398+
}
399+
398400
}
399401
}
400402

403+
@include img-style(true);
404+
401405
a {
402406
blockquote & {
403407
color: var(--link-color);
@@ -412,7 +416,7 @@ footer {
412416
}
413417

414418
&.img-link {
415-
@include img;
419+
@include img-style;
416420
@include img-caption;
417421
}
418422
}
@@ -423,10 +427,6 @@ footer {
423427
}
424428
}
425429

426-
p {
427-
@include img(true);
428-
}
429-
430430
ul {
431431
// attribute 'hide-bullet' was added by liquid
432432
.task-list-item[hide-bullet] {

0 commit comments

Comments
 (0)