Skip to content

Commit

Permalink
Add shadow effect option for images
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed Apr 17, 2021
1 parent 8cbec5c commit 6d56bd5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
6 changes: 5 additions & 1 deletion _posts/2019-08-08-text-and-typography.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Fluttering and dancing in the breeze.

- [ ] TODO
- [x] Completed
- Hold on
- [ ] Defeat COVID-19
- [x] Vaccine production
- [ ] Economic recovery
Expand Down Expand Up @@ -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)_

<br>

- Left aligned
Expand Down
11 changes: 10 additions & 1 deletion _posts/2019-08-08-write-a-new-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 11 additions & 11 deletions _sass/addon/commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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);
Expand All @@ -412,7 +416,7 @@ footer {
}

&.img-link {
@include img;
@include img-style;
@include img-caption;
}
}
Expand All @@ -423,10 +427,6 @@ footer {
}
}

p {
@include img(true);
}

ul {
// attribute 'hide-bullet' was added by liquid
.task-list-item[hide-bullet] {
Expand Down

0 comments on commit 6d56bd5

Please sign in to comment.