Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/react-core/src/components/Compass/Compass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import compassBackgroundImageLight from '@patternfly/react-tokens/dist/esm/c_com
import compassBackgroundImageDark from '@patternfly/react-tokens/dist/esm/c_compass_BackgroundImage_dark';

export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
/** Additional classes added to the compass. */
/** Additional classes added to the Compass. */
className?: string;
/** Content placed at the top of the layout */
header?: React.ReactNode;
Expand All @@ -30,9 +30,9 @@ export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
drawerContent?: React.ReactNode;
/** Additional props passed to the drawer */
drawerProps?: DrawerProps;
/** Light theme background image path of the compass */
/** Light theme background image path of the Compass */
backgroundSrcLight?: string;
/** Dark theme background image path of the compass */
/** Dark theme background image path of the Compass */
backgroundSrcDark?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Compass/compass';
import { css } from '@patternfly/react-styles';

export interface CompassContentProps extends React.HTMLProps<HTMLDivElement> {
/** Content of the main compass area. Typically one or more CompassPanel components. */
/** Content of the main Compass area. Typically one or more CompassPanel components. */
children: React.ReactNode;
/** Additional classes added to the CompassContent */
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { CompassMainHeaderToolbar } from './CompassMainHeaderToolbar';
import styles from '@patternfly/react-styles/css/components/Compass/compass';
import { css } from '@patternfly/react-styles';

/** The wrapper component for header content in the main compass area. When building out a custom implementation,
* you should ensure any content within the main header is rendered inside a compass panel and main header content wrappers.
/** The wrapper component for header content in the main Compass area. When building out a custom implementation,
* you should ensure any content within the main header is rendered inside a Compass panel and main header content wrappers.
*/

export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
Expand All @@ -18,8 +18,8 @@ export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElem
title?: React.ReactNode;
/** Styled toolbar. If title or toolbar is provided, the children will be ignored. */
toolbar?: React.ReactNode;
/** Additional props passed to the compass panel that wraps the main header content when using the title or toolbar props. When using the
* children prop, you should pass your own compass panel.
/** Additional props passed to the Compass panel that wraps the main header content when using the title or toolbar props. When using the
* children prop, you should pass your own Compass panel.
*/
compassPanelProps?: Omit<CompassPanelProps, 'children'>;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from '@patternfly/react-styles/css/components/Compass/compass';
import { css } from '@patternfly/react-styles';

/** A wrapper component to be passed as custom content for the compass main header. This should also be wrapped
* in a compass panel component.
/** A wrapper component to be passed as custom content for the Compass main header. This should also be wrapped
* in a Compass panel component.
*/

export interface CompassMainHeaderContentProps extends React.HTMLProps<HTMLDivElement> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from '@patternfly/react-styles/css/components/Compass/compass';
import { css } from '@patternfly/react-styles';

/** A wrapper component for custom title content to be passed into a compass main header. This should also be wrapped
* by a compass main header content component.
/** A wrapper component for custom title content to be passed into a Compass main header. This should also be wrapped
* by a Compass main header content component.
*/

export interface CompassMainHeaderTitleProps extends React.HTMLProps<HTMLDivElement> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from '@patternfly/react-styles/css/components/Compass/compass';
import { css } from '@patternfly/react-styles';

/** A wrapper component for custom toolbar content to be passed into a compass main header. This should also be wrapped
* by a compass main header content component.
/** A wrapper component for custom toolbar content to be passed into a Compass main header. This should also be wrapped
* by a Compass main header content component.
*/

export interface CompassMainHeaderToolbarProps extends React.HTMLProps<HTMLDivElement> {
Expand Down
31 changes: 13 additions & 18 deletions packages/react-core/src/components/Compass/examples/Compass.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ propComponents:
'CompassHero',
'CompassMainHeader',
'CompassPanel',
'CompassMessageBar'
'CompassMessageBar',
'CompassMainFooter'
]
---

Expand All @@ -28,47 +29,41 @@ import './compass.css';

### Basic

In a basic compass layout, content can be passed to the following props to populate areas of the page:
In a basic Compass layout, content can be passed to the following props to populate different areas of the page:

- `header`: content rendered in the top of the page. This will typically be a `CompassHeader` component to break the header into 3 areas consisting of a logo or brand, middle navigation, and profile.
- `sidebarStart`: content rendered in the left side or start side of the page
- `main`: content rendered in the center of the page. This will typically consist of a `CompassMainHeader` or `CompassHero`, along with a `CompassContent` filled with one or more `CompassPanel` components.
- `sidebarEnd`: content rendered in the right side or end side of the page
- `footer`: content rendered in the bottom of the page
- `header`: Content rendered at the top of the page, typically including a `<CompassHeader>` component that divides the header into 3 areas, with a logo or brand, middle navigation, and profile.
- `sidebarStart`: Content rendered at the horizontal start of the page (by default, the left side).
- `main`: Content rendered in the center of the page, typically including a `<CompassMainHeader>` or `<CompassHero>`, along with a `<CompassContent>` filled with 1 or more `<CompassPanel>` components.
- `sidebarEnd`: Content rendered at the horizontal end of the page (by default, the right side).
- `footer`: Content rendered at the bottom of the page.

The background image of the `Compass` and `CompassHero` may be customized by using their respective `backgroundSrcLight` and `backgroundSrcDark` props. The `CompassHero` also allows customization of a color gradient across its container by using the `gradientLight` and `gradientDark` props.
To customize the background image of the `<Compass>` and `<CompassHero>` components, you can use their respective `backgroundSrcLight` and `backgroundSrcDark` props. You can also add and customize a color gradient background for the `<CompassHero>` component by using the `gradientLight` and `gradientDark` props.

```ts isBeta file="CompassBasic.tsx"

```

### With alternate footer

When `footer` is used, its content will take up the width of the screen. However, if content inside of the footer grows, then the two sidebars' heights and placement will adjust to allow for the change. If this is not the desired behavior, then using a `CompassMainFooter` inside of the of the `main` section provides an alterate way to render footer content without interfering with the sidebars, by rendering content at the bottom of the page between the two sidebars opposed to the whole bottom of the page.
When `footer` is used, its content will fill the width of the screen. By default, when content inside the footer grows, the height and placement of the start and end sidebars will adjust to allow for the change. To modify this behavior and render footer content without interfering with the sidebars, instead place a `<CompassMainFooter>` inside the `main` section. This will render content at the bottom of the page between the 2 sidebars, rather than across the entire bottom of the page.

```ts file="CompassMainFooterDemo.tsx"

```

### Demo

```ts isFullscreen isBeta file="CompassDemo.tsx"

```

## Composable structure

When building a more custom implementation using Compass components, there are some intended or expected structures that must be present.
When building a more custom implementation with Compass components, there are some intended or expected structures that must remain present.

### CompassMainHeader structure

When using the `children` property in the `<CompassMainHeader>` component, you should ensure that the expected sub-components are used. The following code block shows a general structure to follow.
When using the `children` property in the `<CompassMainHeader>` component, there are specific structural patterns that you should follow, as shown this general code structure.

```noLive
<CompassMainHeader>
<CompassPanel>
<CompassMainHeaderContent>
{Your custom content goes here, which can include the CompassMainHeaderTitle and/or CompassMainHeaderToolbar sub-components}
{Your custom content goes here, which can include the <CompassMainHeaderTitle> and/or <CompassMainHeaderToolbar> sub-components}
</CompassMainHeaderContent>
</CompassPanel>
</CompassMainHeader>
Expand Down
27 changes: 27 additions & 0 deletions packages/react-core/src/demos/Compass/Compass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
id: Compass
section: AI
subsection: Generative UIs
---

import { useRef, useState } from 'react';
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
import OutlinedPlusSquare from '@patternfly/react-icons/dist/esm/icons/outlined-plus-square-icon';
import OutlinedCopy from '@patternfly/react-icons/dist/esm/icons/outlined-copy-icon';
import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';

## Demos

### Compass layout

This demo showcases an implementation of the following Compass features:

- Middle navigation in the `header`, featuring top-level primary tabs and a secondary container for sub-tabs.
- Vertical sidebars utilizing `<ActionList>` groups with buttons that use the `isCircle` prop.
- A custom gradient background in the `<Hero>`, visible in dark mode.
- Background images that automatically adapt to both light and dark modes.
- A `footer` section containing the `<CompassMessageBar>`, that could be used for AI text input.

```ts isFullscreen file="./examples/CompassDemo.tsx"

```
Loading