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

SAP / ui5-webcomponents-react / 9566543281

18 Jun 2024 02:04PM CUT coverage: 85.988% (-0.5%) from 86.509%
9566543281

Pull #5939

github

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

2999 of 4413 branches covered (67.96%)

14 of 14 new or added lines in 4 files covered. (100.0%)

68 existing lines in 4 files now uncovered.

5431 of 6316 relevant lines covered (85.99%)

65503.72 hits per line

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

22.22
/packages/main/src/components/DynamicPageHeader/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 './DynamicPageHeader.module.css.js';
9

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

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

28
/**
29
 * The `DynamicPageHeader` component is part of the `DynamicPage` family and is used to serve as header section of the `DynamicPage` and `ObjectPage`.
30
 * This component can be collapsed and pinned by the anchorbar.
31
 *
32
 * __Note:__ When used inside a custom component, it's essential to pass through all props, as otherwise the component won't function as intended!
33
 */
34
const DynamicPageHeader = forwardRef<HTMLDivElement, InternalProps>((props, ref) => {
15✔
UNCOV
35
  const { children, headerPinned, topHeaderHeight, className, style, ...rest } = props;
×
36

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

UNCOV
48
  useStylesheet(styleData, DynamicPageHeader.displayName);
×
49

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

63
DynamicPageHeader.displayName = 'DynamicPageHeader';
15✔
64

65
export { DynamicPageHeader };
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