Skip to content

Commit cf8be69

Browse files
docs(compass): Content review and edits. (#12158)
* docs(compass): Content review and edits. * Capitalizes Compass for consistency * Add CompassMainFooter to props tables --------- Co-authored-by: Nicole Thoen <[email protected]>
1 parent 8dd01a0 commit cf8be69

File tree

9 files changed

+54
-32
lines changed

9 files changed

+54
-32
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import compassBackgroundImageLight from '@patternfly/react-tokens/dist/esm/c_com
66
import compassBackgroundImageDark from '@patternfly/react-tokens/dist/esm/c_compass_BackgroundImage_dark';
77

88
export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
9-
/** Additional classes added to the compass. */
9+
/** Additional classes added to the Compass. */
1010
className?: string;
1111
/** Content placed at the top of the layout */
1212
header?: React.ReactNode;
@@ -30,9 +30,9 @@ export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
3030
drawerContent?: React.ReactNode;
3131
/** Additional props passed to the drawer */
3232
drawerProps?: DrawerProps;
33-
/** Light theme background image path of the compass */
33+
/** Light theme background image path of the Compass */
3434
backgroundSrcLight?: string;
35-
/** Dark theme background image path of the compass */
35+
/** Dark theme background image path of the Compass */
3636
backgroundSrcDark?: string;
3737
}
3838

packages/react-core/src/components/Compass/CompassContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Compass/compass';
33
import { css } from '@patternfly/react-styles';
44

55
export interface CompassContentProps extends React.HTMLProps<HTMLDivElement> {
6-
/** Content of the main compass area. Typically one or more CompassPanel components. */
6+
/** Content of the main Compass area. Typically one or more CompassPanel components. */
77
children: React.ReactNode;
88
/** Additional classes added to the CompassContent */
99
className?: string;

packages/react-core/src/components/Compass/CompassMainHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { CompassMainHeaderToolbar } from './CompassMainHeaderToolbar';
55
import styles from '@patternfly/react-styles/css/components/Compass/compass';
66
import { css } from '@patternfly/react-styles';
77

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

1212
export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
@@ -18,8 +18,8 @@ export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElem
1818
title?: React.ReactNode;
1919
/** Styled toolbar. If title or toolbar is provided, the children will be ignored. */
2020
toolbar?: React.ReactNode;
21-
/** Additional props passed to the compass panel that wraps the main header content when using the title or toolbar props. When using the
22-
* children prop, you should pass your own compass panel.
21+
/** Additional props passed to the Compass panel that wraps the main header content when using the title or toolbar props. When using the
22+
* children prop, you should pass your own Compass panel.
2323
*/
2424
compassPanelProps?: Omit<CompassPanelProps, 'children'>;
2525
}

packages/react-core/src/components/Compass/CompassMainHeaderContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styles from '@patternfly/react-styles/css/components/Compass/compass';
22
import { css } from '@patternfly/react-styles';
33

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

88
export interface CompassMainHeaderContentProps extends React.HTMLProps<HTMLDivElement> {

packages/react-core/src/components/Compass/CompassMainHeaderTitle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styles from '@patternfly/react-styles/css/components/Compass/compass';
22
import { css } from '@patternfly/react-styles';
33

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

88
export interface CompassMainHeaderTitleProps extends React.HTMLProps<HTMLDivElement> {

packages/react-core/src/components/Compass/CompassMainHeaderToolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styles from '@patternfly/react-styles/css/components/Compass/compass';
22
import { css } from '@patternfly/react-styles';
33

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

88
export interface CompassMainHeaderToolbarProps extends React.HTMLProps<HTMLDivElement> {

packages/react-core/src/components/Compass/examples/Compass.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ propComponents:
1212
'CompassHero',
1313
'CompassMainHeader',
1414
'CompassPanel',
15-
'CompassMessageBar'
15+
'CompassMessageBar',
16+
'CompassMainFooter'
1617
]
1718
---
1819

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

2930
### Basic
3031

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

33-
- `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.
34-
- `sidebarStart`: content rendered in the left side or start side of the page
35-
- `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.
36-
- `sidebarEnd`: content rendered in the right side or end side of the page
37-
- `footer`: content rendered in the bottom of the page
34+
- `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.
35+
- `sidebarStart`: Content rendered at the horizontal start of the page (by default, the left side).
36+
- `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.
37+
- `sidebarEnd`: Content rendered at the horizontal end of the page (by default, the right side).
38+
- `footer`: Content rendered at the bottom of the page.
3839

39-
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.
40+
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.
4041

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

4344
```
4445

4546
### With alternate footer
4647

47-
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.
48+
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.
4849

4950
```ts file="CompassMainFooterDemo.tsx"
5051

5152
```
5253

53-
### Demo
54-
55-
```ts isFullscreen isBeta file="CompassDemo.tsx"
56-
57-
```
58-
5954
## Composable structure
6055

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

6358
### CompassMainHeader structure
6459

65-
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.
60+
When using the `children` property in the `<CompassMainHeader>` component, there are specific structural patterns that you should follow, as shown this general code structure.
6661

6762
```noLive
6863
<CompassMainHeader>
6964
<CompassPanel>
7065
<CompassMainHeaderContent>
71-
{Your custom content goes here, which can include the CompassMainHeaderTitle and/or CompassMainHeaderToolbar sub-components}
66+
{Your custom content goes here, which can include the <CompassMainHeaderTitle> and/or <CompassMainHeaderToolbar> sub-components}
7267
</CompassMainHeaderContent>
7368
</CompassPanel>
7469
</CompassMainHeader>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
id: Compass
3+
section: AI
4+
subsection: Generative UIs
5+
---
6+
7+
import { useRef, useState } from 'react';
8+
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
9+
import OutlinedPlusSquare from '@patternfly/react-icons/dist/esm/icons/outlined-plus-square-icon';
10+
import OutlinedCopy from '@patternfly/react-icons/dist/esm/icons/outlined-copy-icon';
11+
import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
12+
13+
## Demos
14+
15+
### Compass layout
16+
17+
This demo showcases an implementation of the following Compass features:
18+
19+
- Middle navigation in the `header`, featuring top-level primary tabs and a secondary container for sub-tabs.
20+
- Vertical sidebars utilizing `<ActionList>` groups with buttons that use the `isCircle` prop.
21+
- A custom gradient background in the `<Hero>`, visible in dark mode.
22+
- Background images that automatically adapt to both light and dark modes.
23+
- A `footer` section containing the `<CompassMessageBar>`, that could be used for AI text input.
24+
25+
```ts isFullscreen file="./examples/CompassDemo.tsx"
26+
27+
```

packages/react-core/src/components/Compass/examples/CompassDemo.tsx renamed to packages/react-core/src/demos/Compass/examples/CompassDemo.tsx

File renamed without changes.

0 commit comments

Comments
 (0)