Skip to content

Commit d9eb9bb

Browse files
authored
docs(ObjectPage): add DomRefTable (SAP#6500)
1 parent f3149af commit d9eb9bb

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

.storybook/components/DomRefTable.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { DocsContext, Heading } from '@storybook/blocks';
2-
import { Tag, Link, MessageStrip, Popover } from '@ui5/webcomponents-react';
32
import TagDesign from '@ui5/webcomponents/dist/types/TagDesign.js';
3+
import { Tag, Link, MessageStrip, Popover } from '@ui5/webcomponents-react';
44
import type * as CEM from '@ui5/webcomponents-tools/lib/cem/types';
55
import type { ReactNode } from 'react';
66
import { Fragment, useContext, useRef } from 'react';
77
import { createPortal } from 'react-dom';
88
import { useGetCem } from '../utils';
99
import classes from './DomRefTable.module.css';
1010

11-
function CodeBlock(props: { children: ReactNode }) {
11+
export function CodeBlock(props: { children: ReactNode }) {
1212
return (
1313
<pre className={classes.domRefCodeBlock}>
1414
<code className={classes.domRefCode}>{props.children}</code>
@@ -57,7 +57,7 @@ export function DomRefTable() {
5757
const knownAttributes = new Set(Object.keys(docsContext.primaryStory?.argTypes ?? {}));
5858
const cem = useGetCem();
5959

60-
let moduleName = cemModuleName ? cemModuleName.split(':')[1] : componentName;
60+
const moduleName = cemModuleName ? cemModuleName.split(':')[1] : componentName;
6161

6262
const componentMembers =
6363
cem?.modules
@@ -119,7 +119,7 @@ export function DomRefTable() {
119119
)}
120120
</td>
121121
<td>
122-
{!!row.parameters ? (
122+
{row.parameters ? (
123123
row.parameters.map((parameter) => {
124124
return (
125125
<div key={parameter.name} className={classes.parameters}>

packages/main/src/components/ObjectPage/ObjectPage.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ObjectPageTitle } from '../ObjectPageTitle';
66
import { ObjectPageHeader } from '../ObjectPageHeader';
77
import { ObjectPageSection } from '../ObjectPageSection';
88
import { ObjectPageSubSection } from '../ObjectPageSubSection';
9+
import { CodeBlock } from '@sb/components/DomRefTable';
910

1011
<Meta of={ComponentStories} />
1112

@@ -19,6 +20,47 @@ import { ObjectPageSubSection } from '../ObjectPageSubSection';
1920

2021
<ControlsWithNote of={ComponentStories.Default} />
2122

23+
## Methods
24+
25+
This component exposes public methods. You can use them directly on the instance of the component, e.g. by using React Refs.
26+
27+
<table>
28+
<thead>
29+
<tr>
30+
<th>Name</th>
31+
<th>Parameters</th>
32+
<th>Description</th>
33+
</tr>
34+
</thead>
35+
<tbody>
36+
<tr>
37+
<td>
38+
<CodeBlock>
39+
<span style={{ color: 'rgb(64, 120, 242)' }}>toggleHeaderArea</span>
40+
<span style={{ color: 'rgb(56, 58, 66)' }}>(</span>
41+
<span style={{ color: 'rgb(56, 58, 66)' }}>snapped</span>
42+
<span style={{ color: 'rgb(64, 120, 242)' }}>?</span>
43+
<span style={{ color: 'rgb(64, 120, 242)' }}>: </span>
44+
<span style={{ color: 'rgb(80, 161, 79)' }}>boolean</span>
45+
<span style={{ color: 'rgb(56, 58, 66)' }}>)</span>
46+
<span style={{ color: 'rgb(64, 120, 242)' }}>: </span>
47+
<span style={{ color: 'rgb(80, 161, 79)' }}>void</span>
48+
</CodeBlock>
49+
</td>
50+
<td>
51+
<div>
52+
<p style={{ fontWeight: 'bold' }}>snapped</p>
53+
<p style={{ paddingInline: '1rem' }}>
54+
Defines if the header should be snapped or expanded. <br /> If the argument is not provided, the header is
55+
toggled.
56+
</p>
57+
</div>
58+
</td>
59+
<td>Toggles the `headerArea` of the `ObjectPage`.</td>
60+
</tr>
61+
</tbody>
62+
</table>
63+
2264
# More Examples
2365

2466
## ObjectPage with IllustratedMessage (`UnableToLoad`) placeholder

0 commit comments

Comments
 (0)