-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
62 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ | |
public class ComponentRichImage { | ||
|
||
private FeaturedImage image; | ||
private Boolean fullWidth; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ query findImage($id: String!){ | |
height | ||
url | ||
} | ||
fullWidth | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<div class="py-4"> | ||
<img src="{image.url}" style="width: 100%; height: 250px; object-fit: cover; object-position: 50% 50%;" alt="{image.title}"> | ||
{#if image.fullWidth} | ||
<img src="{image.url}" style="width: 100%; object-fit: cover; object-position: 50% 50%;" alt="{image.title}"> | ||
{#else} | ||
<img src="{image.url}" style="width: {image.width}px; height: {image.height};" alt="{image.title}"> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 11 additions & 10 deletions
21
...vice/contentful/image/ImageConverter.java → ...ul/blogpost/converter/ImageConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
package com.gdevxy.blog.service.contentful.image; | ||
package com.gdevxy.blog.service.contentful.blogpost.converter; | ||
|
||
import java.util.function.Function; | ||
|
||
import com.gdevxy.blog.client.contentful.model.FeaturedImage; | ||
import com.gdevxy.blog.model.Image; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import java.util.function.Function; | ||
import com.gdevxy.blog.client.contentful.model.FeaturedImage; | ||
import com.gdevxy.blog.model.Image; | ||
|
||
@ApplicationScoped | ||
public class ImageConverter implements Function<FeaturedImage, Image> { | ||
|
||
@Override | ||
public Image apply(FeaturedImage fi) { | ||
public Image apply(FeaturedImage image) { | ||
|
||
return Image.builder() | ||
.url(fi.getUrl()) | ||
.width(fi.getWidth()) | ||
.height(fi.getHeight()) | ||
.contentType(fi.getContentType()) | ||
.build(); | ||
.url(image.getUrl()) | ||
.width(image.getWidth()) | ||
.height(image.getHeight()) | ||
.contentType(image.getContentType()) | ||
.build(); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...c/main/java/com/gdevxy/blog/service/contentful/blogpost/converter/RichImageConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.gdevxy.blog.service.contentful.blogpost.converter; | ||
|
||
import java.util.function.Function; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import com.gdevxy.blog.client.contentful.model.ComponentRichImage; | ||
import com.gdevxy.blog.model.Image; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@ApplicationScoped | ||
@RequiredArgsConstructor | ||
public class RichImageConverter implements Function<ComponentRichImage, Image> { | ||
|
||
private final ImageConverter imageConverter; | ||
|
||
@Override | ||
public Image apply(ComponentRichImage i) { | ||
|
||
return imageConverter.apply(i.getImage()).toBuilder() | ||
.fullWidth(i.getFullWidth()) | ||
.build(); | ||
} | ||
|
||
} |
30 changes: 0 additions & 30 deletions
30
service/src/main/java/com/gdevxy/blog/service/contentful/image/ImageService.java
This file was deleted.
Oops, something went wrong.