diff --git a/src/components/InfoBar/InfoBar.stories.tsx b/src/components/InfoBar/InfoBar.stories.tsx index cea4e1ab9..e7dd31f12 100644 --- a/src/components/InfoBar/InfoBar.stories.tsx +++ b/src/components/InfoBar/InfoBar.stories.tsx @@ -59,6 +59,7 @@ const infoBarArgs: Object = { id: 'myActionButton', text: 'Action', }, + bordered: false, closable: true, content: 'Body2 is used inside here.', style: {}, diff --git a/src/components/InfoBar/InfoBar.test.tsx b/src/components/InfoBar/InfoBar.test.tsx index 2c0e43c68..0b10ff745 100644 --- a/src/components/InfoBar/InfoBar.test.tsx +++ b/src/components/InfoBar/InfoBar.test.tsx @@ -80,4 +80,12 @@ describe('InfoBar', () => { expect(container.querySelector('.warning')).toBeTruthy(); expect(container).toMatchSnapshot(); }); + + test('InfoBar is bordered', () => { + const { container } = render( + + ); + expect(container.querySelector('.bordered')).toBeTruthy(); + expect(container).toMatchSnapshot(); + }); }); diff --git a/src/components/InfoBar/InfoBar.tsx b/src/components/InfoBar/InfoBar.tsx index 930fbcce3..b98924348 100644 --- a/src/components/InfoBar/InfoBar.tsx +++ b/src/components/InfoBar/InfoBar.tsx @@ -14,6 +14,7 @@ export const InfoBar: FC = React.forwardRef( (props: InfoBarsProps, ref: Ref) => { const { actionButtonProps, + bordered = false, classNames, closable, closeButtonAriaLabelText: defaultCloseButtonAriaLabelText, @@ -54,6 +55,7 @@ export const InfoBar: FC = React.forwardRef( const infoBarClasses: string = mergeClasses([ styles.infoBar, + { [styles.bordered]: !!bordered }, classNames, { [styles.neutral]: type === InfoBarType.neutral }, { [styles.positive]: type === InfoBarType.positive }, diff --git a/src/components/InfoBar/InfoBar.types.ts b/src/components/InfoBar/InfoBar.types.ts index 2fb559859..bc9f540d3 100644 --- a/src/components/InfoBar/InfoBar.types.ts +++ b/src/components/InfoBar/InfoBar.types.ts @@ -32,6 +32,11 @@ export interface InfoBarsProps extends OcBaseProps { * Props for the action button */ actionButtonProps?: ButtonProps; + /** + * Whether to visually hide the InfoBar border. + * @default false + */ + bordered?: boolean; /** * If the InfoBar is closable or not */ diff --git a/src/components/InfoBar/__snapshots__/InfoBar.test.tsx.snap b/src/components/InfoBar/__snapshots__/InfoBar.test.tsx.snap index b9f6bc73a..f6e768017 100644 --- a/src/components/InfoBar/__snapshots__/InfoBar.test.tsx.snap +++ b/src/components/InfoBar/__snapshots__/InfoBar.test.tsx.snap @@ -124,6 +124,37 @@ exports[`InfoBar InfoBar is Warning 1`] = ` `; +exports[`InfoBar InfoBar is bordered 1`] = ` +
+ +
+`; + exports[`InfoBar Renders a custom icon when the icon prop uses a custom icon 1`] = `