Skip to content

Commit

Permalink
add image object-fit config
Browse files Browse the repository at this point in the history
  • Loading branch information
fschmidt committed Jun 26, 2024
1 parent 9407f5c commit 06539ce
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class TbConfiguration {
static final TbConfiguration DEFAULT = new TbConfiguration(true, TbFontConfig.newInstance(),
TbTextConfig.newInstance(),
TbTextConfig.newInstanceSmall(),
TbSideImageLineConfig.newInstance(),
TbButtonConfig.newInstance(),
TbAttributeConfig.newInstance(),
TbBoxConfig.newInstance(),
Expand All @@ -28,6 +29,7 @@ public static final TbConfiguration newInstance() {
private TbFontConfig font;
private TbTextConfig text;
private TbTextConfig imageText;
private TbSideImageLineConfig sideImageLine;
private TbButtonConfig button;
private TbAttributeConfig attribute;
private TbBoxConfig box;
Expand All @@ -41,6 +43,7 @@ public TbConfiguration(TbConfiguration other) {
this.font = new TbFontConfig(other.font);
this.text = new TbTextConfig(other.text);
this.imageText = new TbTextConfig(other.imageText);
this.sideImageLine = new TbSideImageLineConfig(other.sideImageLine);
this.button = new TbButtonConfig(other.button);
this.attribute = new TbAttributeConfig(other.attribute);
this.box = new TbBoxConfig(other.box);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.rocketbase.mail.config.config;

import io.rocketbase.mail.styling.ObjectFit;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class TbSideImageLineConfig {

static final TbSideImageLineConfig DEFAULT = new TbSideImageLineConfig(ObjectFit.NONE);

private ObjectFit objectFit;

public TbSideImageLineConfig(TbSideImageLineConfig other) {
this.objectFit = other.objectFit;
}

public static TbSideImageLineConfig newInstance() {
return new TbSideImageLineConfig(DEFAULT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.rocketbase.mail.styling;

import lombok.Getter;

public enum ObjectFit {
CONTAIN("contain"),
COVER("cover"),
FILL("fill"),
INHERENT("inherent"),
INITIAL("initial"),
NONE("none"),
REVERT("revert"),
REVERT_LAYER("revert-layer"),
SCALE_DOWN("scale-down"),
UNSET("unset");

@Getter
private String value;

ObjectFit(String value) {
this.value = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@
line-height: {{ c.imageText.lineHeight | default('1.325') }};
}

.body-gallery img,
.body-side-image img {
object-fit: {{ c.sideImageLine.objectFit | default('none') }};
}

.body-sub {
margin-top: 25px;
padding-top: 25px;
Expand Down Expand Up @@ -387,6 +392,9 @@
<td class="attributes_item" {% if line.valueWidth is not empty %} width="{{- line.valueWidth -}}" {% endif %} style="color: {{ c.font.table.color | default('#333333') }}; font-family: {{ c.font.family | default("'Nunito Sans', Helvetica, Arial, sans-serif") | raw }}; font-size: {{ c.font.table.size | default('16px') }}; padding: 0; word-break: break-word;" valign="top">
<span class="f-fallback">{{entry.value | escape}}</span>
</td>



</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit 06539ce

Please sign in to comment.