Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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 @@ -95,3 +95,7 @@
[data-component-name='ObjectPageContent'] {
padding: 0 !important;
}

div[data-component-name='DynamicPageTitleActions'] {
overflow: visible;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropTypes from 'prop-types';
import { CSSProperties, ReactNode, useEffect, useState } from 'react';
import {
Button,
DynamicPage,
Expand All @@ -12,7 +12,6 @@ import {

import './DynamicPageComponent.scss';
import { spacing } from '@ui5/webcomponents-react-base';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useRecoilState } from 'recoil';
import { columnLayoutState } from 'state/columnLayoutAtom';
Expand All @@ -21,7 +20,38 @@ import { isResourceEditedState } from 'state/resourceEditedAtom';
import { isFormOpenState } from 'state/formOpenAtom';
import { handleActionIfFormOpen } from '../UnsavedMessageBox/helpers';

const Column = ({ title, children, columnSpan, image, style = {} }) => {
type ColumnProps = {
title: string;
children?: ReactNode;
columnSpan?: string;
image?: any;
style?: CSSProperties | undefined;
};
type DynamicPageComponentProps = {
headerContent?: JSX.Element;
title: string;
description?: ReactNode;
actions?: JSX.Element | JSX.Element[];
children?: ReactNode;
columnWrapperClassName?: string;
content?: any;
footer?: JSX.Element;
layoutNumber?: string;
layoutCloseUrl?: string;
inlineEditForm?: (stickyHeaderHeight: any) => JSX.Element;
showYamlTab?: boolean;
protectedResource?: boolean;
protectedResourceWarning?: JSX.Element;
className?: string;
};

const Column = ({
title,
children,
columnSpan,
image,
style = {},
}: ColumnProps) => {
const styleComputed = { gridColumn: columnSpan, ...style };
return (
<div className="page-header__column" style={styleComputed}>
Expand Down Expand Up @@ -50,7 +80,7 @@ export const DynamicPageComponent = ({
protectedResource,
protectedResourceWarning,
className,
}) => {
}: DynamicPageComponentProps) => {
const [showTitleDescription, setShowTitleDescription] = useState(false);
const [layoutColumn, setLayoutColumn] = useRecoilState(columnLayoutState);
const { t } = useTranslation();
Expand Down Expand Up @@ -93,7 +123,7 @@ export const DynamicPageComponent = ({

const headerTitle = (
<DynamicPageTitle
style={title === 'Clusters Overview' ? { display: 'none' } : null}
style={title === 'Clusters Overview' ? { display: 'none' } : undefined}
header={
<FlexBox alignItems="Center">
<Title level="H3" className="bold-title">
Expand All @@ -109,7 +139,7 @@ export const DynamicPageComponent = ({
style={spacing.sapUiTinyMargin}
setShowTitleDescription={setShowTitleDescription}
showTitleDescription={showTitleDescription}
description={description}
description={description ?? ''}
ariaTitle={title}
/>
)}
Expand Down Expand Up @@ -223,7 +253,9 @@ export const DynamicPageComponent = ({
{children}
</section>
</DynamicPageHeader>
) : null;
) : (
undefined
);

const [stickyHeaderHeight, setStickyHeaderHeight] = useState(0);

Expand Down Expand Up @@ -269,7 +301,7 @@ export const DynamicPageComponent = ({
);

if (e.detail.sectionId === 'edit') {
setIsFormOpen({ formOpen: true });
setIsFormOpen(prev => ({ ...prev, formOpen: true }));
}
}}
>
Expand Down Expand Up @@ -316,12 +348,3 @@ export const DynamicPageComponent = ({
);
};
DynamicPageComponent.Column = Column;

DynamicPageComponent.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.node,
};

DynamicPageComponent.defaultProps = {
description: '',
};
19 changes: 13 additions & 6 deletions src/shared/components/ResourceDetails/ResourceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,12 @@ function Resource({
customStatusColumns?.length ? (
<>
{customStatusColumns
?.filter(filterColumns)
.filter(col => !col?.conditionComponent)
?.filter(col => !col?.fullWidth || col?.fullWidth === false)
?.filter(
col =>
filterColumns(col) &&
!col?.conditionComponent &&
!col?.fullWidth,
)
?.map(col => (
<DynamicPageComponent.Column
key={col.header}
Expand All @@ -311,9 +314,13 @@ function Resource({
customStatusColumns?.length ? (
<>
{customStatusColumns
?.filter(filterColumns)
.filter(col => !col?.conditionComponent)
?.filter(col => col?.fullWidth && col?.fullWidth === true)
?.filter(
col =>
filterColumns(col) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider to rename this filter fn to mean something more

!col?.conditionComponent &&
col?.fullWidth &&
col?.fullWidth === true,
)
?.map(col => (
<DynamicPageComponent.Column
key={col.header}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import { spacing } from '@ui5/webcomponents-react-base';
import { Card, CardHeader } from '@ui5/webcomponents-react';
import './ResourceDetails.scss';

type ResourceDetailsCardProps = {
content: JSX.Element;
wrapperClassname: string;
titleText: string;
className?: string;
};

export default function ResourceDetailsCard({
content,
wrapperClassname,
titleText,
className = '',
}) {
}: ResourceDetailsCardProps) {
return (
<div style={spacing.sapUiSmallMarginBeginEnd} className={wrapperClassname}>
<Card className={className} header={<CardHeader titleText={titleText} />}>
Expand Down
Loading