Skip to content

Commit

Permalink
feat(Panel): consumed Penta updates (#9946)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye authored Jan 17, 2024
1 parent 87d0bb0 commit 6fdf5fe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/react-core/src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface PanelProps extends React.HTMLProps<HTMLDivElement> {
/** Class to add to outer div */
className?: string;
/** Adds panel variant styles */
variant?: 'raised' | 'bordered';
variant?: 'raised' | 'bordered' | 'secondary';
/** Flag to add scrollable styling to the panel */
isScrollable?: boolean;
/** @hide Forwarded ref */
Expand All @@ -26,8 +26,7 @@ const PanelBase: React.FunctionComponent<PanelProps> = ({
<div
className={css(
styles.panel,
variant === 'raised' && styles.modifiers.raised,
variant === 'bordered' && styles.modifiers.bordered,
variant && styles.modifiers[variant],
isScrollable && styles.modifiers.scrollable,
className
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ test(`Renders with class name ${styles.modifiers.bordered} when variant is borde
expect(screen.getByText('Test')).toHaveClass(styles.modifiers.bordered);
});

test(`Renders with class name ${styles.modifiers.secondary} when variant is secondary`, () => {
render(<Panel variant="secondary">Test</Panel>);
expect(screen.getByText('Test')).toHaveClass(styles.modifiers.secondary);
});

test(`Renders with class name ${styles.modifiers.scrollable} when isScrollable is true`, () => {
render(<Panel isScrollable>Test</Panel>);
expect(screen.getByText('Test')).toHaveClass(styles.modifiers.scrollable);
Expand Down
15 changes: 15 additions & 0 deletions packages/react-core/src/components/Panel/examples/Panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ const BorderedPanel = () => (
);
```

### Secondary variant

```js
import React from 'react';
import { Panel, PanelMain, PanelMainBody } from '@patternfly/react-core';

const PanelSecondaryVariant = () => (
<Panel variant="secondary">
<PanelMain>
<PanelMainBody>Main content</PanelMainBody>
</PanelMain>
</Panel>
);
```

### Scrollable

```js
Expand Down

0 comments on commit 6fdf5fe

Please sign in to comment.