• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / ui5-webcomponents-react / 9566331569

18 Jun 2024 01:51PM CUT coverage: 85.696% (-0.8%) from 86.509%
9566331569

Pull #5939

github

web-flow
Merge eeda993ce into 8348998c0
Pull Request #5939: feat(DynamicPage & ObjectPage): use ui5wc `DynamicPage` & rename `ObjectPage` components

2980 of 4413 branches covered (67.53%)

8 of 11 new or added lines in 4 files covered. (72.73%)

9 existing lines in 1 file now uncovered.

5416 of 6320 relevant lines covered (85.7%)

65164.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

22.22
/packages/main/src/components/ObjectPageHeader/index.tsx
1
'use client';
2

3
import { useStylesheet } from '@ui5/webcomponents-react-base';
4
import { clsx } from 'clsx';
5
import type { ReactNode } from 'react';
6
import { forwardRef, useMemo } from 'react';
7
import type { CommonProps } from '../../types/index.js';
8
import { classNames, styleData } from './ObjectPageHeader.module.css.js';
9

10
export interface ObjectPageHeaderPropTypes extends CommonProps {
11
  /**
12
   * Content of the `ObjectPageHeader`.
13
   */
14
  children?: ReactNode | ReactNode[];
15
}
16

17
export interface InternalProps extends ObjectPageHeaderPropTypes {
18
  /**
19
   * Determines if the header is pinned.
20
   */
21
  headerPinned?: boolean;
22
  /**
23
   * Determines the height of the top header (`ObjectPageTitle`).
24
   */
25
  topHeaderHeight?: number;
26
}
27

28
/**
29
 * The `ObjectPageHeader` component is used to serve as header section of the `ObjectPage`. It can hold any layout control and has two states - expanded and collapsed.
30
 *
31
 * __Note:__ When used inside a custom component, it's essential to pass through all props, as otherwise the component won't function as intended!
32
 */
33
const ObjectPageHeader = forwardRef<HTMLDivElement, InternalProps>((props, ref) => {
124✔
34
  const { children, headerPinned, topHeaderHeight, className, style, ...rest } = props;
×
35

36
  const headerStyles = useMemo(() => {
×
37
    if (headerPinned) {
×
38
      return {
×
39
        ...style,
40
        top: `${topHeaderHeight}px`,
41
        zIndex: 1
42
      };
43
    }
44
    return style;
×
45
  }, [headerPinned, topHeaderHeight, style]);
46

NEW
47
  useStylesheet(styleData, ObjectPageHeader.displayName);
×
48

49
  return (
×
50
    <div
51
      ref={ref}
52
      {...rest}
53
      className={clsx(classNames.header, className)}
54
      data-component-name="ObjectPageHeader"
55
      style={headerStyles}
56
    >
57
      {children}
58
    </div>
59
  );
60
});
61

62
ObjectPageHeader.displayName = 'ObjectPageHeader';
124✔
63

64
export { ObjectPageHeader };
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc