Skip to content

Commit fc3cefa

Browse files
committed
feat(Compass): add CompassMainFooter
1 parent b1ae7eb commit fc3cefa

File tree

7 files changed

+89
-4
lines changed

7 files changed

+89
-4
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import styles from '@patternfly/react-styles/css/components/Compass/compass';
2+
import { css } from '@patternfly/react-styles';
3+
4+
interface CompassMainFooterProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
5+
/** Additional classes added to the main footer */
6+
className?: string;
7+
/** Main footer content */
8+
children?: React.ReactNode;
9+
}
10+
11+
export const CompassMainFooter: React.FunctionComponent<CompassMainFooterProps> = ({
12+
className,
13+
children,
14+
...props
15+
}) => (
16+
<div className={css(`${styles.compass}__main-footer`, className)} {...props}>
17+
{children}
18+
</div>
19+
);
20+
21+
CompassMainFooter.displayName = 'CompassMainFooter';

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ propComponents:
1616
]
1717
---
1818

19-
import './compass.css';
2019
import { useRef, useState } from 'react';
2120
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
2221
import OutlinedPlusSquare from '@patternfly/react-icons/dist/esm/icons/outlined-plus-square-icon';
2322
import OutlinedCopy from '@patternfly/react-icons/dist/esm/icons/outlined-copy-icon';
2423
import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
2524

25+
import './compass.css';
26+
2627
## Examples
2728

2829
### Basic
@@ -41,6 +42,14 @@ The background image of the `Compass` and `CompassHero` may be customized by usi
4142

4243
```
4344

45+
### With alternate footer
46+
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+
49+
```ts file="CompassMainFooterDemo.tsx"
50+
51+
```
52+
4453
### Demo
4554

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Compass, CompassHeader, CompassHero, CompassContent, CompassMainHeader } from '@patternfly/react-core';
2-
import './compass.css';
32

43
export const CompassBasic: React.FunctionComponent = () => {
54
const headerContent = <CompassHeader logo={<div>Logo</div>} nav={<div>Nav</div>} profile={<div>Profile</div>} />;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {
2+
Compass,
3+
CompassHeader,
4+
CompassHero,
5+
CompassContent,
6+
CompassMainHeader,
7+
CompassMainFooter
8+
} from '@patternfly/react-core';
9+
import './compass.css';
10+
11+
export const CompassMainFooterDemo: React.FunctionComponent = () => {
12+
const headerContent = <CompassHeader logo={<div>Logo</div>} nav={<div>Nav</div>} profile={<div>Profile</div>} />;
13+
const sidebarStartContent = <div>Sidebar start</div>;
14+
// TODO: simplify mainContent to only a div string
15+
const mainContent = (
16+
<>
17+
<CompassHero>
18+
<div>Hero</div>
19+
</CompassHero>
20+
<CompassContent>
21+
<CompassMainHeader>
22+
<div>Content title</div>
23+
</CompassMainHeader>
24+
<div>Content</div>
25+
</CompassContent>
26+
<CompassMainFooter>
27+
<div>Footer</div>
28+
</CompassMainFooter>
29+
</>
30+
);
31+
const sidebarEndContent = <div>Sidebar end</div>;
32+
33+
return (
34+
<Compass
35+
header={headerContent}
36+
sidebarStart={sidebarStartContent}
37+
main={mainContent}
38+
sidebarEnd={sidebarEndContent}
39+
isFooterExpanded={false}
40+
/>
41+
);
42+
};

packages/react-core/src/components/Compass/examples/compass.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
#ws-react-c-compass-basic [class*="pf-v6-c-compass"] {
1+
#ws-react-p-compass-basic [class*="pf-v6-c-compass"] {
22
position: relative;
33
}
44

5-
#ws-react-c-compass-basic [class*="pf-v6-c-compass"]::after {
5+
#ws-react-p-compass-basic [class*="pf-v6-c-compass"]::after {
6+
content: "";
7+
position: absolute;
8+
inset: 0;
9+
border: var(--pf-t--global--border--width--regular) dashed var(--pf-t--global--border--color--default);
10+
pointer-events: none;
11+
}
12+
13+
#ws-react-p-compass-with-alternate-footer [class*="pf-v6-c-compass"] {
14+
position: relative;
15+
}
16+
17+
#ws-react-p-compass-with-alternate-footer [class*="pf-v6-c-compass"]:not([class*="footer"])::after {
618
content: "";
719
position: absolute;
820
inset: 0;

packages/react-core/src/components/Compass/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export * from './CompassContent';
33
export * from './CompassHeader';
44
export * from './CompassHero';
55
export * from './CompassMainHeader';
6+
export * from './CompassMainFooter';
67
export * from './CompassMessageBar';
78
export * from './CompassPanel';

packages/react-docs/patternfly-docs/patternfly-docs.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
hasDesignGuidelines: false,
1111
sideNavItems: [
1212
{ section: 'get-started' },
13+
{ section: 'PatternFly-AI' },
1314
{ section: 'developer-resources' },
1415
{ section: 'charts' },
1516
{ section: 'components' },

0 commit comments

Comments
 (0)