Skip to content

Commit 1e26c6c

Browse files
committed
rebase, add panel props, update CompassMainHeader panel props name
1 parent 3743d81 commit 1e26c6c

6 files changed

Lines changed: 13 additions & 17 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const Compass: React.FunctionComponent<CompassProps> = ({
110110
);
111111

112112
return (
113-
<div className={css(styles.compass, dock !== undefined && styles.modifiers.docked, className)} {...props}>
113+
<div className={css(styles.compass, dock && styles.modifiers.docked, className)} {...props}>
114114
{hasDrawer ? (
115115
<Drawer isPill {...drawerProps}>
116116
<DrawerContent panelContent={drawerContent}>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElem
2121
/** Additional props passed to the Panel that wraps the main header content when using the title or toolbar props. When using the
2222
* children prop, you should pass your own Panel.
2323
*/
24-
compassPanelProps?: Omit<PanelProps, 'children'>;
24+
panelProps?: Omit<PanelProps, 'children'>;
2525
}
2626

2727
export const CompassMainHeader: React.FunctionComponent<CompassMainHeaderProps> = ({
2828
className,
2929
title,
3030
toolbar,
3131
children,
32-
compassPanelProps,
32+
panelProps,
3333
...props
3434
}: CompassMainHeaderProps) => {
3535
const _content =
3636
title !== undefined || toolbar !== undefined ? (
37-
<Panel {...compassPanelProps}>
37+
<Panel {...panelProps}>
3838
<PanelMain>
3939
<PanelMainBody>
4040
<CompassMainHeaderContent>

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,15 @@ test('Does not render Panel when children are passed', () => {
100100
expect(content).not.toHaveClass(panelStyles.panel);
101101
});
102102

103-
test('Passes props to Panel when title and compassPanelProps is passed', () => {
104-
render(
105-
<CompassMainHeader data-testid="test-id" compassPanelProps={{ className: 'panel-class' }} title="Title text" />
106-
);
103+
test('Passes props to Panel when title and panelProps is passed', () => {
104+
render(<CompassMainHeader data-testid="test-id" panelProps={{ className: 'panel-class' }} title="Title text" />);
107105

108106
const panel = screen.getByTestId('test-id').firstChild;
109107
expect(panel).toHaveClass('panel-class');
110108
});
111109

112-
test('Passes props to Panel when toolbar and compassPanelProps is passed', () => {
113-
render(
114-
<CompassMainHeader data-testid="test-id" compassPanelProps={{ className: 'panel-class' }} toolbar="Toolbar text" />
115-
);
110+
test('Passes props to Panel when toolbar and panelProps is passed', () => {
111+
render(<CompassMainHeader data-testid="test-id" panelProps={{ className: 'panel-class' }} toolbar="Toolbar text" />);
116112

117113
const panel = screen.getByTestId('test-id').firstChild;
118114
expect(panel).toHaveClass('panel-class');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In a basic Compass layout, content can be passed to the following props to popul
3535
- `sidebarEnd`: Content rendered at the horizontal end of the page (by default, the right side).
3636
- `footer`: Content rendered at the bottom of the page.
3737

38-
The background image of `<Compass>` is set at a global level alongside the theme. You can customize the background image of `<CompassHero>` by using its `backgroundSrcLight` and `backgroundSrcDark` props, or you may set a gradient using the `gradientLight` and `gradientDark` props.
38+
The background image of `<Compass>` is set at a global level alongside the theme. You can customize the background image of the `<Hero>` inside `<CompassHero>` by using its `backgroundSrcLight` and `backgroundSrcDark` props, or you may set a gradient using the `gradientLight` and `gradientDark` props.
3939

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export const CompassBasic: React.FunctionComponent = () => {
153153
Hero
154154
</Hero>
155155
</CompassHero>
156-
<CompassMainHeader title={<Title headingLevel="h1">Content title</Title>} />
156+
<CompassMainHeader title={<Title headingLevel="h1">Content title</Title>} panelProps={{ isGlass: true }} />
157157
<CompassContent>
158-
<Panel>
158+
<Panel isScrollable isAutoHeight isFullHeight isGlass>
159159
<PanelMain>
160160
<PanelMainBody>Content</PanelMainBody>
161161
</PanelMain>

packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ export const CompassDockDemo: React.FunctionComponent = () => {
377377

378378
const mainContent = (
379379
<>
380-
<CompassMainHeader title={<Title headingLevel="h1">Content title</Title>} />
380+
<CompassMainHeader title={<Title headingLevel="h1">Content title</Title>} panelProps={{ isGlass: true }} />
381381
<CompassContent>
382-
<Panel>
382+
<Panel isScrollable isAutoHeight isFullHeight isGlass>
383383
<PanelMain>
384384
<PanelMainBody>Content</PanelMainBody>
385385
</PanelMain>

0 commit comments

Comments
 (0)