Skip to content

Commit

Permalink
refactor: make Banner actions optional (#3416)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunohkbx authored Oct 18, 2022
1 parent 5700fe5 commit e3f7ad6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type Props = $RemoveChildren<typeof Surface> & {
*
* To customize button you can pass other props that button component takes.
*/
actions: Array<
actions?: Array<
{
label: string;
} & Omit<React.ComponentProps<typeof Button>, 'children'>
Expand Down Expand Up @@ -128,7 +128,7 @@ const Banner = ({
visible,
icon,
children,
actions,
actions = [],
contentStyle,
elevation = 1,
style,
Expand Down
5 changes: 2 additions & 3 deletions src/components/__tests__/Banner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Banner from '../Banner.tsx';
it('renders hidden banner, without action buttons and without image', () => {
const tree = renderer
.create(
<Banner visible={false} actions={[]}>
<Banner visible={false}>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
Expand All @@ -21,7 +21,7 @@ it('renders hidden banner, without action buttons and without image', () => {
it('renders visible banner, without action buttons and without image', () => {
const tree = renderer
.create(
<Banner visible actions={[]}>
<Banner visible>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
Expand Down Expand Up @@ -62,7 +62,6 @@ it('renders visible banner, without action buttons and with image', () => {
accessibilityIgnoresInvertColors
/>
)}
actions={[]}
>
Two line text string with two actions. One to two lines is preferable on
mobile.
Expand Down

0 comments on commit e3f7ad6

Please sign in to comment.