Skip to content

Commit

Permalink
fixup! Feat(web-twig): Attachment image preview object fit #DS-1005
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelklibani committed Oct 24, 2023
1 parent 2a2d712 commit ac2a4de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{%- set _imagePreview = props.imagePreview | default(null) -%}
{%- set _onEdit = props.onEdit | default(null) -%}
{%- set _removeText = props.removeText | default('Remove') -%}
{%- set _objectFit = props.objectFit | default(null) -%}
{%- set _imageObjectFit = props.imageObjectFit | default(null) -%}

{# Class names #}
{%- set _rootClassName = _spiritClassPrefix ~ 'FileUploaderAttachment' -%}
Expand All @@ -19,7 +19,7 @@

{# Attributes #}
{%- set _dataImagePreviewAttr = _generateImagePreview ? 'data-spirit-imagePreview="true"' : null -%}
{%- set _objectFitAttr = _objectFit ? 'data-spirit-object-fit=' ~ _objectFit : null -%}
{%- set _imageObjectFitAttr = _imageObjectFit ? 'data-spirit-image-object-fit=' ~ _imageObjectFit : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
Expand All @@ -34,8 +34,8 @@
{{ _dataImagePreviewAttr | raw }}
>
{% if _generateImagePreview or _imagePreview %}
<span class="{{ _imageClassName }}" {{ _objectFitAttr }}>
<img src="{{ _imagePreview }}" width="54" height="54" alt="{{- _fileName -}}" />
<span class="{{ _imageClassName }}">
<img src="{{ _imagePreview }}" {{ _imageObjectFitAttr }} width="54" height="54" alt="{{- _fileName -}}" />
</span>
{% endif %}
{% if not _imagePreview %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ With image preview:
| `generateImagePreview` | `bool` | `false` || If true and used in the attachment template, the JS plugin will try to show a preview of the image |
| `iconName` | `string` | `file` || Icon shown along the file |
| `imagePreview` | `string` | `null` || URL or base64 of an image |
| `objectFit` | [`cover` \| `contain`] | `cover` || CSS value for image preview in FileUploaderAttachment |
| `imageObjectFit` | [`cover` \| `contain`] | `cover` || Defines FileUploaderAttachment image fit in container |
| `onEdit` | `func` | `null` || Function to trigger on click on edit button |
| `removeText` | `string` | `Remove` || Remove button text |

Expand Down

0 comments on commit ac2a4de

Please sign in to comment.