Skip to content

fix(ObjectPage): use full width for header content if no image is set #7046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
margin-block-end: 0.25rem;
background-color: var(--sapObjectHeader_Background);
display: grid;
}
.hasAvatar {
grid-auto-columns: min-content calc(100% - 5rem - 2rem);

[data-component-name='ObjectPageHeaderContent'] {
Expand Down Expand Up @@ -188,4 +190,4 @@
.clickArea {
position: absolute;
inset: 0;
}
}
11 changes: 8 additions & 3 deletions packages/main/src/components/ObjectPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,19 @@ const ObjectPage = forwardRef<ObjectPageDomRef, ObjectPagePropTypes>((props, ref
<span
className={classNames.headerImage}
style={{ borderRadius: imageShapeCircle ? '50%' : 0, overflow: 'hidden' }}
data-component-name="ObjectPageHeaderImage"
>
<img src={image} className={classNames.image} alt="Company Logo" />
</span>
);
} else {
return cloneElement(image, {
size: AvatarSize.L,
className: clsx(classNames.headerImage, image.props?.className)
className: clsx(classNames.headerImage, image.props?.className),
'data-component-name': 'ObjectPageHeaderImage'
} as AvatarPropTypes);
}
}, [image, classNames.headerImage, classNames.image, imageShapeCircle]);
}, [image, imageShapeCircle]);

const scrollToSectionById = (id: string | undefined, isSubSection = false) => {
const section = getSectionElementById(objectPageRef.current, isSubSection, id);
Expand Down Expand Up @@ -639,7 +641,10 @@ const ObjectPage = forwardRef<ObjectPageDomRef, ObjectPagePropTypes>((props, ref
//@ts-expect-error: todo remove me when forwardref has been replaced
ref: componentRefHeaderContent,
children: (
<div className={classNames.headerContainer} data-component-name="ObjectPageHeaderContainer">
<div
className={clsx(classNames.headerContainer, avatar && classNames.hasAvatar)}
data-component-name="ObjectPageHeaderContainer"
>
{avatar}
{headerArea.props.children && (
<div data-component-name="ObjectPageHeaderContent">{headerArea.props.children}</div>
Expand Down
Loading