Skip to content

Commit

Permalink
fix(nav): Rename ContentHeader to PageHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac committed Sep 12, 2024
1 parent 6dcd13f commit 0219c05
Show file tree
Hide file tree
Showing 24 changed files with 137 additions and 137 deletions.
11 changes: 0 additions & 11 deletions cypress/component/ContentHeader.cy.tsx

This file was deleted.

11 changes: 11 additions & 0 deletions cypress/component/PageHeader.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';

describe('PageHeader', () => {
it('should render PageHeader title and subtitle', () => {
cy.mount(<PageHeader title='My title' subtitle='This is a subtitle for your page header' />);
cy.get('title').should('exist')
cy.get('[data-ouia-component-id="PageHeader-title"]').should('have.text', 'My title')
cy.get('[data-ouia-component-id="PageHeader-subtitle"]').should('have.text', 'This is a subtitle for your page header')
})
});
4 changes: 2 additions & 2 deletions cypress/component/ServiceCard.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('ServiceCard', () => {
title='Example'
subtitle='A basic example'
description='This is a basic ServiceCard Example'
icon={<img src="/" alt="content-header-icon" />}
icon={<img src="/" alt="page-header-icon" />}
helperText='Here is helper text'
ouiaId='Example'
/>)
Expand All @@ -21,7 +21,7 @@ describe('ServiceCard', () => {
title='Example'
subtitle='A basic example'
description='This is a basic ServiceCard Example'
icon={<img src="/" alt="content-header-icon" />}
icon={<img src="/" alt="page-header-icon" />}
helperText='Here is helper text'
ouiaId='Example'
footer={<>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
section: Component groups
subsection: Content containers
id: Page header
source: react
propComponents: ['PageHeader']
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/PageHeader/PageHeader.md
---

import PageHeader from "@patternfly/react-component-groups/dist/dynamic/PageHeader"
import { EllipsisVIcon } from '@patternfly/react-icons';
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg'

The **page header** component displays a page header section with a title, subtitle and other optional content.

## Examples

### Basic page header

In order to display a basic page header, pass the `title` and `subtitle`.

```js file="./PageHeaderExample.tsx"

```

### Page header with breadcrumbs

You can display breadcrumbs above the title using the `breadcrumbs` property.

```js file="./PageHeaderBreadcrumbExample.tsx"

```

### Page header with icon

Use the `icon` property to display your custom page icon separated with a [divider](/components/divider).

```js file="./PageHeaderIconExample.tsx"

```

### Page header with label and link

To add specific element captions for user clarity and convenience, you can use the `label` property together with [label](/components/label) or your custom component. The `linkProps` can be used to define a link displayed under the subtitle.

```js file="./PageHeaderLabelLinkExample.tsx"

```

### Page header with actions menu

In case you want to display actions in your header, you can use the `actionsMenu` property.

```js file="./PageHeaderActionsExample.tsx"

```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ContentHeader from '@patternfly/react-component-groups/dist/dynamic/ContentHeader';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';
import { ActionList, ActionListItem, Dropdown, DropdownItem, DropdownList, MenuToggle, MenuToggleElement } from '@patternfly/react-core';
import { EllipsisVIcon } from '@patternfly/react-icons';

Expand Down Expand Up @@ -29,9 +29,9 @@ export const ActionsExample: React.FunctionComponent = () => {

return (
<React.Fragment>
<ContentHeader
<PageHeader
title='My Title'
subtitle='This is a subtitle for your content header'
subtitle='This is a subtitle for your page header'
actionMenu={
<ActionList>
<ActionListItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import ContentHeader from '@patternfly/react-component-groups/dist/dynamic/ContentHeader';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';
import { Breadcrumb, BreadcrumbItem } from '@patternfly/react-core';

export const BreadCrumbExample: React.FunctionComponent = () => (
<ContentHeader
export const BreadcrumbExample: React.FunctionComponent = () => (
<PageHeader
breadcrumbs={
<Breadcrumb>
<BreadcrumbItem
Expand All @@ -29,6 +29,6 @@ export const BreadCrumbExample: React.FunctionComponent = () => (
</Breadcrumb>
}
title='My Title'
subtitle='This is a subtitle for your content header'
subtitle='This is a subtitle for your page header'
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';

export const BasicExample: React.FunctionComponent = () => (
<PageHeader
title='My Title'
subtitle='This is a subtitle for your page header'
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg';


export const IconExample: React.FunctionComponent = () => (
<PageHeader
title='My Title'
subtitle='This is a subtitle for your page header'
icon={<img src={pageHeaderIcon} alt="page-header-icon" />}
/>
);
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import ContentHeader from '@patternfly/react-component-groups/dist/dynamic/ContentHeader';
import PageHeader from '@patternfly/react-component-groups/dist/dynamic/PageHeader';
import { Label } from '@patternfly/react-core';

export const BasicExample: React.FunctionComponent = () => (
<ContentHeader
<PageHeader
title='My Title'
subtitle='This is a subtitle for your content header'
subtitle='This is a subtitle for your page header'
label={<Label className="pf-v5-u-align-content-center">Org. Administrator</Label>}
linkProps={{
label: 'Go to this link',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packa

import ServiceCard from "@patternfly/react-component-groups/dist/dynamic/ServiceCard";
import { EllipsisVIcon } from '@patternfly/react-icons';
import contentHeaderIcon from '../../assets/icons/content-header-icon.svg'
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg'

The **service card** component displays a card representing a service with an icon, title, description, and an optional customized footer

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import ServiceCard from "@patternfly/react-component-groups/dist/dynamic/ServiceCard";
import contentHeaderIcon from '../../assets/icons/content-header-icon.svg';
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg';
import { Button, ButtonVariant } from '@patternfly/react-core';

export const BasicExample: React.FunctionComponent = () => (
<ServiceCard
title='PatternFly'
subtitle='Component groups'
description='This is a sample service description'
icon={<img src={contentHeaderIcon} alt="content-header-icon" />}
icon={<img src={pageHeaderIcon} alt="page-header-icon" />}
helperText='Here is helper text'
footer={<>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ServiceCard from "@patternfly/react-component-groups/dist/dynamic/Service
import { Gallery } from '@patternfly/react-core/dist/dynamic/layouts/Gallery';
import { GalleryItem } from '@patternfly/react-core/dist/dynamic/layouts/Gallery';
import { Button, ButtonVariant } from '@patternfly/react-core';
import contentHeaderIcon from '../../assets/icons/content-header-icon.svg';
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg';

export const ServiceCardGalleryExample: React.FunctionComponent = () => (
<Gallery hasGutter minWidths={{ default: '330px' }}>
Expand All @@ -13,7 +13,7 @@ export const ServiceCardGalleryExample: React.FunctionComponent = () => (
title='Example1'
subtitle='A basic example'
description='This is a basic ServiceCard example'
icon={<img src={contentHeaderIcon} alt="content-header-icon" />}
icon={<img src={pageHeaderIcon} alt="page-header-icon" />}
helperText='Example helper text'
/>
</GalleryItem>
Expand All @@ -23,7 +23,7 @@ export const ServiceCardGalleryExample: React.FunctionComponent = () => (
title='Example2'
subtitle='A second example'
description='This is another basic ServiceCard example'
icon={<img src={contentHeaderIcon} alt="content-header-icon" />}
icon={<img src={pageHeaderIcon} alt="page-header-icon" />}
helperText='Example helper text'
footer={<>
<Button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ServiceCard from "@patternfly/react-component-groups/dist/dynamic/ServiceCard";
import contentHeaderIcon from '../../assets/icons/content-header-icon.svg';
import pageHeaderIcon from '../../assets/icons/page-header-icon.svg';
import { Button, ButtonVariant } from '@patternfly/react-core';


Expand All @@ -10,7 +10,7 @@ export const BasicExample: React.FunctionComponent = () => (
title='Example'
subtitle='A basic example'
description='This is a basic ServiceCard Example'
icon={<img src={contentHeaderIcon} alt="content-header-icon" />}
icon={<img src={pageHeaderIcon} alt="page-header-icon" />}
helperText='Here is helper text'
footer={<>
<Button
Expand Down
9 changes: 0 additions & 9 deletions packages/module/src/ContentHeader/ContentHeader.test.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/module/src/ContentHeader/index.ts

This file was deleted.

9 changes: 9 additions & 0 deletions packages/module/src/PageHeader/PageHeader.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { render } from '@testing-library/react';
import PageHeader from './PageHeader';

describe('PageHeader component', () => {
test('should render', () => {
expect(render(<PageHeader title='My title' subtitle='This is a subtitle for your page header' />)).toMatchSnapshot();
});
});
Loading

0 comments on commit 0219c05

Please sign in to comment.