Skip to content

Commit 54e1018

Browse files
authored
Add blur for assets with nsfw=true (#2210)
1 parent 1d8a602 commit 54e1018

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

generate-assets/src/bin/generate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct FrontMatterAssetExtra {
127127
image: Option<String>,
128128
licenses: Option<Vec<String>>,
129129
bevy_versions: Option<Vec<String>>,
130+
nsfw: Option<bool>,
130131
}
131132

132133
impl From<&Asset> for FrontMatterAsset {
@@ -140,6 +141,7 @@ impl From<&Asset> for FrontMatterAsset {
140141
image: asset.image.clone(),
141142
licenses: asset.licenses.clone(),
142143
bevy_versions: asset.bevy_versions.clone(),
144+
nsfw: asset.nsfw,
143145
},
144146
}
145147
}

generate-assets/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct Asset {
2828
pub crate_name: Option<String>,
2929
pub licenses: Option<Vec<String>>,
3030
pub bevy_versions: Option<Vec<String>>,
31+
pub nsfw: Option<bool>,
3132

3233
// this field is not read from the toml file
3334
#[serde(skip)]

sass/components/_asset-card.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ $asset-card-padding: 0.4rem;
3434
}
3535
}
3636

37+
&__blur-overlay {
38+
backdrop-filter: blur(16px);
39+
width: 100%;
40+
height: 100%;
41+
position: absolute;
42+
top: 0;
43+
}
44+
3745
&__title {
3846
position: absolute;
3947
width: 100%;

templates/macros/assets.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<div id="{{ post.title | slugify }}">
1515
<a class="asset-card" href="{{ post.extra.link }}">
1616
<div class="asset-card__banner">
17+
{% if post.extra.nsfw %}<div class="asset-card__blur-overlay"></div>{% endif %}
1718
<div class="asset-card__title">{{ post.title }}</div>
1819
{% if post.extra.image %}
1920
<img src="{{ image_macros::resize_image(path=post.extra.image, width=370, height=370) }}"

0 commit comments

Comments
 (0)