Skip to content

Commit ebdfa87

Browse files
rename prop and add it to render method
1 parent 2b8ccb3 commit ebdfa87

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

packages/react-core/src/components/Page/Page.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ export interface PageProps extends React.HTMLProps<HTMLDivElement> {
8181
isBreadcrumbGrouped?: boolean;
8282
/** Additional content of the group */
8383
additionalGroupedContent?: React.ReactNode;
84-
/** HTML tag used as main component of the page, defaults to 'main'. */
85-
mainTag?: 'main' | 'div';
84+
/** HTML component used as main component of the page, defaults to 'main'. */
85+
mainComponent?: 'main' | 'div';
8686
/** Additional props of the group */
8787
groupProps?: PageGroupProps;
8888
/** Additional props of the breadcrumb */
@@ -106,7 +106,7 @@ export class Page extends React.Component<PageProps, PageState> {
106106
mainTabIndex: -1,
107107
isNotificationDrawerExpanded: false,
108108
onNotificationDrawerExpand: () => null,
109-
mainTag: 'main',
109+
mainComponent: 'main',
110110
getBreakpoint,
111111
getVerticalBreakpoint
112112
};
@@ -232,6 +232,7 @@ export class Page extends React.Component<PageProps, PageState> {
232232
getVerticalBreakpoint,
233233
mainAriaLabel,
234234
mainTabIndex,
235+
mainComponent,
235236
tertiaryNav,
236237
isTertiaryNavGrouped,
237238
isBreadcrumbGrouped,
@@ -291,10 +292,10 @@ export class Page extends React.Component<PageProps, PageState> {
291292
</PageGroup>
292293
) : null;
293294

294-
const MainTag: keyof JSX.IntrinsicElements = this.props.mainTag;
295+
const MainComponent: keyof JSX.IntrinsicElements = mainComponent;
295296

296297
const main = (
297-
<MainTag
298+
<MainComponent
298299
ref={this.mainRef}
299300
role={role}
300301
id={mainContainerId}
@@ -306,7 +307,7 @@ export class Page extends React.Component<PageProps, PageState> {
306307
{!isTertiaryNavGrouped && nav}
307308
{!isBreadcrumbGrouped && crumb}
308309
{children}
309-
</MainTag>
310+
</MainComponent>
310311
);
311312

312313
const panelContent = <DrawerPanelContent>{notificationDrawer}</DrawerPanelContent>;

packages/react-core/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ exports[`Page Check dark page against snapshot 1`] = `
66
aria-label="Page layout"
77
class="pf-v5-c-page my-page-class"
88
id="PageId"
9-
maintag="main"
109
>
1110
<header
1211
class="pf-v5-c-page__header"
@@ -68,7 +67,6 @@ exports[`Page Check page horizontal layout example against snapshot 1`] = `
6867
aria-label="Page layout"
6968
class="pf-v5-c-page my-page-class"
7069
id="PageId"
71-
maintag="main"
7270
>
7371
<header
7472
class="pf-v5-c-page__header"
@@ -129,7 +127,6 @@ exports[`Page Check page to verify breadcrumb is created - PageBreadcrumb syntax
129127
aria-label="Page layout"
130128
class="pf-v5-c-page my-page-class"
131129
id="PageId"
132-
maintag="main"
133130
>
134131
<header
135132
class="pf-v5-c-page__header"
@@ -294,7 +291,6 @@ exports[`Page Check page to verify breadcrumb is created 1`] = `
294291
aria-label="Page layout"
295292
class="pf-v5-c-page my-page-class"
296293
id="PageId"
297-
maintag="main"
298294
>
299295
<header
300296
class="pf-v5-c-page__header"
@@ -459,7 +455,6 @@ exports[`Page Check page to verify grouped nav and breadcrumb - new components s
459455
aria-label="Page layout"
460456
class="pf-v5-c-page my-page-class"
461457
id="PageId"
462-
maintag="main"
463458
>
464459
<header
465460
class="pf-v5-c-page__header"
@@ -744,7 +739,6 @@ exports[`Page Check page to verify grouped nav and breadcrumb - old / props synt
744739
aria-label="Page layout"
745740
class="pf-v5-c-page my-page-class"
746741
id="PageId"
747-
maintag="main"
748742
>
749743
<header
750744
class="pf-v5-c-page__header"
@@ -1036,7 +1030,6 @@ exports[`Page Check page to verify nav is created - PageNavigation syntax 1`] =
10361030
aria-label="Page layout"
10371031
class="pf-v5-c-page my-page-class"
10381032
id="PageId"
1039-
maintag="main"
10401033
>
10411034
<header
10421035
class="pf-v5-c-page__header"
@@ -1214,7 +1207,6 @@ exports[`Page Check page to verify skip to content points to main content region
12141207
class="pf-v5-c-page my-page-class"
12151208
data-testid="page-test-id"
12161209
id="PageId"
1217-
maintag="main"
12181210
>
12191211
<div
12201212
class="pf-v5-c-skip-to-content"
@@ -1394,7 +1386,6 @@ exports[`Page Check page vertical layout example against snapshot 1`] = `
13941386
aria-label="Page layout"
13951387
class="pf-v5-c-page my-page-class"
13961388
id="PageId"
1397-
maintag="main"
13981389
>
13991390
<header
14001391
class="pf-v5-c-page__header"
@@ -1456,7 +1447,6 @@ exports[`Page Sticky bottom breadcrumb on all height breakpoints - PageBreadcrum
14561447
aria-label="Page layout"
14571448
class="pf-v5-c-page my-page-class"
14581449
id="PageId"
1459-
maintag="main"
14601450
>
14611451
<header
14621452
class="pf-v5-c-page__header"
@@ -1621,7 +1611,6 @@ exports[`Page Verify sticky bottom breadcrumb on all height breakpoints 1`] = `
16211611
aria-label="Page layout"
16221612
class="pf-v5-c-page my-page-class"
16231613
id="PageId"
1624-
maintag="main"
16251614
>
16261615
<header
16271616
class="pf-v5-c-page__header"
@@ -1786,7 +1775,6 @@ exports[`Page Verify sticky top breadcrumb on all height breakpoints - PageBread
17861775
aria-label="Page layout"
17871776
class="pf-v5-c-page my-page-class"
17881777
id="PageId"
1789-
maintag="main"
17901778
>
17911779
<header
17921780
class="pf-v5-c-page__header"
@@ -1951,7 +1939,6 @@ exports[`Page Verify sticky top breadcrumb on all height breakpoints 1`] = `
19511939
aria-label="Page layout"
19521940
class="pf-v5-c-page my-page-class"
19531941
id="PageId"
1954-
maintag="main"
19551942
>
19561943
<header
19571944
class="pf-v5-c-page__header"

0 commit comments

Comments
 (0)