Skip to content

Commit

Permalink
#562770: fixed Image component highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-ruslanmatkovskyi committed Aug 20, 2023
1 parent 99f1b47 commit 856e19b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
opacity: 0;
}
&.scEnabledChrome {
.sc-image-wrapper {
display: block;
width: 100%;

.scEmptyImage {
max-height: 800px;
max-width: 100%;
&.hero-banner-empty {
.sc-image-wrapper {
display: block;
width: 100%;

.scEmptyImage {
max-height: 800px;
max-width: 100%;
width: 100%;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const ImageDefault = (props: ImageProps): JSX.Element => (

export const Banner = (props: ImageProps): JSX.Element => {
const { sitecoreContext } = useSitecoreContext();
const isPageEditing = sitecoreContext.pageEditing;
const classHeroBannerEmpty =
isPageEditing && props.fields?.Image?.value?.class === 'scEmptyImage'
? 'hero-banner-empty'
: '';
const backgroundStyle = { backgroundImage: `url('${props?.fields?.Image?.value?.src}')` };
const modifyImageProps = {
...props.fields.Image,
Expand All @@ -40,7 +45,10 @@ export const Banner = (props: ImageProps): JSX.Element => {
const id = props.params.RenderingIdentifier;

return (
<div className={`component hero-banner ${props.params.styles}`} id={id ? id : undefined}>
<div
className={`component hero-banner ${props.params.styles} ${classHeroBannerEmpty}`}
id={id ? id : undefined}
>
<div className="component-content sc-sxa-image-hero-banner" style={backgroundStyle}>
{sitecoreContext.pageEditing ? <JssImage field={modifyImageProps} /> : ''}
</div>
Expand Down

0 comments on commit 856e19b

Please sign in to comment.