Skip to content

Commit

Permalink
[templates/nextjs-sxa]: Image component has been fixed for metadata mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Matkovskyi committed Jun 18, 2024
1 parent 0110bbf commit 00e9c79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Our versioning strategy is as follows:
### 🐛 Bug Fixes

* `[templates/nextjs]` `[templates/react]` `[templates/vue]` `[templates/angular]` Changed formatting in temp/config to prevent parse issues in Unix systems ([#1787](https://github.com/Sitecore/jss/pull/1787))([#1791](https://github.com/Sitecore/jss/pull/1791))
* `[templates/nextjs-sxa]` The banner variant of image component is fixed with supporting metadata mode. ([#1826](https://github.com/Sitecore/jss/pull/1826))

### 🎉 New Features & Improvements

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { CSSProperties } from 'react';
import {
EditMode,
Field,
ImageField,
Image as JssImage,
Link as JssLink,
ImageField,
Field,
LinkField,
Text,
useSitecoreContext,
EditMode,
} from '@sitecore-jss/sitecore-jss-nextjs';
import React, { CSSProperties } from 'react';

interface Fields {
Image: ImageField & { metadata?: { [key: string]: unknown } };
Expand Down Expand Up @@ -48,7 +48,14 @@ export const Banner = (props: ImageProps): JSX.Element => {
?.replace(`width="${props?.fields?.Image?.value?.width}"`, 'width="100%"')
.replace(`height="${props?.fields?.Image?.value?.height}"`, 'height="100%"'),
}
: { ...props.fields.Image };
: {
...props.fields.Image,
value: {
...props.fields.Image.value,
width: "100%",
height: "100%",
},
};

return (
<div
Expand Down

0 comments on commit 00e9c79

Please sign in to comment.