Skip to content

Commit 876dd3d

Browse files
committed
pr feedback, update demo background
1 parent 519a195 commit 876dd3d

13 files changed

Lines changed: 44 additions & 41 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
1212
header?: React.ReactNode;
1313
/** Flag indicating if the header is expanded */
1414
isHeaderExpanded?: boolean;
15-
/** Content placed at the start of the layout */
15+
/** Content placed at the horizontal start of the layout, before the main content */
1616
sidebarStart?: React.ReactNode;
1717
/** Flag indicating if the start sidebar is expanded */
1818
isSidebarStartExpanded?: boolean;
1919
/** Content placed at the center of the layout */
2020
main?: React.ReactNode;
21-
/** Content placed at the end of the layout */
21+
/** Content placed at the horizontal end of the layout, after the main content */
2222
sidebarEnd?: React.ReactNode;
2323
/** Flag indicating if the end sidebar is expanded */
2424
isSidebarEndExpanded?: boolean;

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
interface CompassContentProps extends React.HTMLProps<HTMLDivElement> {
6-
/** Content of the main compass area. Typically one or more CompassSection 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/CompassHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface CompassHeaderProps {
1212

1313
export const CompassHeader: React.FunctionComponent<CompassHeaderProps> = ({ logo, nav, profile }) => (
1414
<>
15-
<div className={css('pf-v6-c-compass__logo')}>{logo}</div>
15+
<div className={css(`${styles.compass}__logo`)}>{logo}</div>
1616
<div className={css(styles.compassNav)}>{nav}</div>
1717
<div className={css(styles.compassProfile)}>{profile}</div>
1818
</>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Flex, FlexItem } from '../../layouts/Flex';
22
import { CompassPanel } from './CompassPanel';
3+
import styles from '@patternfly/react-styles/css/components/Compass/compass';
34
import { css } from '@patternfly/react-styles';
45

56
interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
@@ -25,15 +26,15 @@ export const CompassMainHeader: React.FunctionComponent<CompassMainHeaderProps>
2526
<CompassPanel>
2627
<Flex alignItems={{ default: 'alignItemsCenter' }}>
2728
<FlexItem grow={{ default: 'grow' }}>{title}</FlexItem>
28-
<FlexItem>{toolbar}</FlexItem>
29+
{toolbar && <FlexItem>{toolbar}</FlexItem>}
2930
</Flex>
3031
</CompassPanel>
3132
) : (
3233
children
3334
);
3435

3536
return (
36-
<div className={css('pf-v6-c-compass__main-header', className)} {...props}>
37+
<div className={css(`${styles.compass}__main-header`, className)} {...props}>
3738
{_content}
3839
</div>
3940
);

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ interface CompassPanelProps extends React.HTMLProps<HTMLDivElement> {
1616
hasNoBorder?: boolean;
1717
/** Indicates the panel should have no padding */
1818
hasNoPadding?: boolean;
19-
/** Indicates the panel should have a gradient border */
20-
hasGradientBorder?: boolean;
21-
/** Indicates the panel should have a thinking style */
19+
/** Indicates the panel should have a "thinking" animation */
2220
isThinking?: boolean;
2321
}
2422

@@ -28,7 +26,6 @@ export const CompassPanel: React.FunctionComponent<CompassPanelProps> = ({
2826
isPill,
2927
hasNoBorder,
3028
hasNoPadding,
31-
hasGradientBorder,
3229
isThinking,
3330
isFullHeight,
3431
isScrollable,
@@ -37,11 +34,10 @@ export const CompassPanel: React.FunctionComponent<CompassPanelProps> = ({
3734
<div
3835
className={css(
3936
styles.compassPanel,
40-
isPill && 'pf-m-pill',
37+
isPill && styles.modifiers.pill,
4138
hasNoBorder && styles.modifiers.noBorder,
4239
hasNoPadding && styles.modifiers.noPadding,
43-
hasGradientBorder && 'pf-m-gradient-border',
44-
isThinking && 'pf-m-thinking',
40+
isThinking && 'pf-v6-m-thinking',
4541
isFullHeight && styles.modifiers.fullHeight,
4642
isScrollable && styles.modifiers.scrollable,
4743
className

packages/react-core/src/components/Compass/__tests__/CompassHeader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ test('Renders all content when all props are provided', () => {
3333
expect(screen.getByText('Profile')).toBeVisible();
3434
});
3535

36-
test('Renders logo with pf-v6-c-compass__logo class', () => {
36+
test(`Renders logo with ${styles.compass}__logo class`, () => {
3737
render(<CompassHeader logo={<div>Logo</div>} />);
38-
expect(screen.getByText('Logo').parentElement).toHaveClass('pf-v6-c-compass__logo');
38+
expect(screen.getByText('Logo').parentElement).toHaveClass(`${styles.compass}__logo`);
3939
});
4040

4141
test(`Renders nav with ${styles.compassNav} class`, () => {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { render, screen } from '@testing-library/react';
22
import { CompassMainHeader } from '../CompassMainHeader';
3+
import styles from '@patternfly/react-styles/css/components/Compass/compass';
34

45
test('Renders without children', () => {
56
render(
@@ -20,9 +21,9 @@ test('Renders with custom class name when className prop is provided', () => {
2021
expect(screen.getByText('Test')).toHaveClass('custom-class');
2122
});
2223

23-
test('Renders with default pf-v6-c-compass__main-header class', () => {
24+
test(`Renders with default ${styles.compass}__main-header class`, () => {
2425
render(<CompassMainHeader>Test</CompassMainHeader>);
25-
expect(screen.getByText('Test')).toHaveClass('pf-v6-c-compass__main-header');
26+
expect(screen.getByText('Test')).toHaveClass(`${styles.compass}__main-header`);
2627
});
2728

2829
test('Renders title when provided', () => {

packages/react-core/src/components/Compass/__tests__/CompassPanel.test.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@ test(`Renders with ${styles.modifiers.noPadding} when hasNoPadding is true`, ()
3232
expect(screen.getByText('Test')).toHaveClass(styles.modifiers.noPadding);
3333
});
3434

35-
test('Renders with pf-m-gradient-border when hasGradientBorder is true', () => {
36-
render(<CompassPanel hasGradientBorder>Test</CompassPanel>);
37-
expect(screen.getByText('Test')).toHaveClass('pf-m-gradient-border');
38-
});
39-
40-
test('Renders with pf-m-thinking when isThinking is true', () => {
35+
test('Renders with pf-v6-m-thinking when isThinking is true', () => {
4136
render(<CompassPanel isThinking>Test</CompassPanel>);
42-
expect(screen.getByText('Test')).toHaveClass('pf-m-thinking');
37+
expect(screen.getByText('Test')).toHaveClass('pf-v6-m-thinking');
4338
});
4439

4540
test(`Renders with ${styles.modifiers.fullHeight} when isFullHeight is true`, () => {
@@ -54,16 +49,15 @@ test(`Renders with ${styles.modifiers.scrollable} when isScrollable is true`, ()
5449

5550
test('Renders with multiple modifier classes when multiple props are true', () => {
5651
render(
57-
<CompassPanel isPill hasNoBorder hasNoPadding hasGradientBorder isThinking isFullHeight isScrollable>
52+
<CompassPanel isPill hasNoBorder hasNoPadding isThinking isFullHeight isScrollable>
5853
Test
5954
</CompassPanel>
6055
);
6156
const panelElement = screen.getByText('Test');
6257
expect(panelElement).toHaveClass(styles.modifiers.pill);
6358
expect(panelElement).toHaveClass(styles.modifiers.noBorder);
6459
expect(panelElement).toHaveClass(styles.modifiers.noPadding);
65-
expect(panelElement).toHaveClass('pf-m-gradient-border');
66-
expect(panelElement).toHaveClass('pf-m-thinking');
60+
expect(panelElement).toHaveClass('pf-v6-m-thinking');
6761
expect(panelElement).toHaveClass(styles.modifiers.fullHeight);
6862
expect(panelElement).toHaveClass(styles.modifiers.scrollable);
6963
});
@@ -75,7 +69,7 @@ test('Renders with additional props spread to the component', () => {
7569

7670
test('Matches the snapshot with all modifiers', () => {
7771
const { asFragment } = render(
78-
<CompassPanel isPill hasNoBorder hasNoPadding hasGradientBorder isThinking isFullHeight isScrollable>
72+
<CompassPanel isPill hasNoBorder hasNoPadding isThinking isFullHeight isScrollable>
7973
<div>Panel with all modifiers</div>
8074
</CompassPanel>
8175
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`Matches the snapshot with all modifiers 1`] = `
44
<DocumentFragment>
55
<div
6-
class="pf-v6-c-compass__panel pf-m-pill pf-m-no-border pf-m-no-padding pf-m-gradient-border pf-m-thinking pf-m-full-height pf-m-scrollable"
6+
class="pf-v6-c-compass__panel pf-m-pill pf-m-no-border pf-m-no-padding pf-v6-m-thinking pf-m-full-height pf-m-scrollable"
77
>
88
<div>
99
Panel with all modifiers

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: Compass
33
cssPrefix: pf-v6-c-compass
44
section: components
5-
isBeta: true
5+
beta: true
66
propComponents: ['Compass', 'CompassHeader', 'CompassContent', 'CompassHero', 'CompassMainHeader', 'CompassPanel']
77
---
88

0 commit comments

Comments
 (0)