Skip to content

Commit c198598

Browse files
haoruikun-cbhcopp
authored andcommitted
fix: borderRadius not applying issue in banner (#190)
* fix: borderRadius not applying issue in banner, updated doc to showcase borderRadius * chore: changelog * chore: clean up Banner styale implementation * chore: clean up unused variables
1 parent d4769a8 commit c198598

File tree

14 files changed

+195
-57
lines changed

14 files changed

+195
-57
lines changed

apps/docs/docs/components/feedback/Banner/_mobileExamples.mdx

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The global warning banner is used to communicate important alerts or warnings to users across the entire platform, ensuring universal visibility and building trust.
44

5-
```jsx live
5+
```tsx
66
<Banner
77
showDismiss
88
startIcon="warning"
@@ -24,7 +24,7 @@ The global warning banner is used to communicate important alerts or warnings to
2424

2525
The In-line Error Banner is used to display specific error messages directly beneath the relevant section headers. Use in-line banners to help users identify exactly where the error or outage is located.
2626

27-
```jsx live
27+
```tsx
2828
<Banner
2929
startIcon="info"
3030
startIconActive
@@ -45,7 +45,7 @@ The In-line Error Banner is used to display specific error messages directly ben
4545

4646
The Contextual Promotional Banner is used to highlight special offers, promotions, or announcements within a specific context or section of the platform. It is used to increase user engagement and drive conversions.
4747

48-
```jsx live
48+
```tsx
4949
<Banner
5050
startIcon="info"
5151
startIconActive
@@ -64,7 +64,7 @@ The Contextual Promotional Banner is used to highlight special offers, promotion
6464

6565
The in-line Informational Banner is used to provide users with additional information or helpful tips directly within the content or interface, providing relevant guidance.
6666

67-
```jsx live
67+
```tsx
6868
<VStack gap={2}>
6969
<Banner
7070
startIcon="info"
@@ -93,3 +93,42 @@ The in-line Informational Banner is used to provide users with additional inform
9393
</Banner>
9494
</VStack>
9595
```
96+
97+
### Rounded Corner Banners
98+
99+
Customize `borderRadius` to align contextual or in-line banners with surrounding surfaces.
100+
101+
```tsx
102+
<VStack gap={2}>
103+
<Banner
104+
borderRadius={200}
105+
startIcon="info"
106+
startIconActive
107+
styleVariant="contextual"
108+
title="Rounded contextual banner"
109+
variant="informational"
110+
>
111+
<TextLabel2>
112+
Use moderate rounding to soften banners that live within card-based layouts.
113+
</TextLabel2>
114+
</Banner>
115+
<Banner
116+
borderRadius={400}
117+
primaryAction={<Link to="https://www.coinbase.com">Primary</Link>}
118+
secondaryAction={<Link to="https://www.coinbase.com">Secondary</Link>}
119+
startIcon="info"
120+
startIconActive
121+
styleVariant="inline"
122+
title="Rounded inline banner"
123+
variant="promotional"
124+
>
125+
<TextLabel2>
126+
Larger radii can help inline banners feel cohesive with pill-shaped buttons or chips nearby.
127+
</TextLabel2>
128+
</Banner>
129+
</VStack>
130+
```
131+
132+
:::tip
133+
Avoid setting `borderRadius` for `styleVariant="global"` so the vertical status bar remains aligned.
134+
:::

apps/docs/docs/components/feedback/Banner/_webExamples.mdx

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The global warning banner is used to communicate important alerts or warnings to users across the entire platform, ensuring universal visibility and building trust.
44

5-
```jsx live
5+
```tsx live
66
<Banner
77
showDismiss
88
label="Message last updated today at 3:33pm"
@@ -25,7 +25,7 @@ The global warning banner is used to communicate important alerts or warnings to
2525

2626
The In-line Error Banner is used to display specific error messages directly beneath the relevant section headers. Use in-line banners to help users identify exactly where the error or outage is located.
2727

28-
```jsx live
28+
```tsx live
2929
<Banner
3030
startIcon="info"
3131
startIconActive
@@ -46,7 +46,7 @@ The In-line Error Banner is used to display specific error messages directly ben
4646

4747
The Contextual Promotional Banner is used to highlight special offers, promotions, or announcements within a specific context or section of the platform. It is used to increase user engagement and drive conversions.
4848

49-
```jsx live
49+
```tsx live
5050
<Banner
5151
startIcon="info"
5252
startIconActive
@@ -65,7 +65,7 @@ The Contextual Promotional Banner is used to highlight special offers, promotion
6565

6666
The in-line Informational Banner is used to provide users with additional information or helpful tips directly within the content or interface, providing relevant guidance.
6767

68-
```jsx live
68+
```tsx live
6969
<VStack gap={2}>
7070
<Banner
7171
startIcon="info"
@@ -94,3 +94,42 @@ The in-line Informational Banner is used to provide users with additional inform
9494
</Banner>
9595
</VStack>
9696
```
97+
98+
### Rounded Corner Banners
99+
100+
You can customize `borderRadius` to soften contextual and in-line banners.
101+
102+
```tsx live
103+
<VStack gap={2}>
104+
<Banner
105+
borderRadius={200}
106+
startIcon="info"
107+
startIconActive
108+
styleVariant="contextual"
109+
title="Rounded contextual banner"
110+
variant="informational"
111+
>
112+
<TextLabel2 as="p">
113+
Rounded corners help align with softer surface treatments within a page section.
114+
</TextLabel2>
115+
</Banner>
116+
<Banner
117+
borderRadius={400}
118+
primaryAction={<Link to="https://www.coinbase.com">Primary</Link>}
119+
secondaryAction={<Link to="https://www.coinbase.com">Secondary</Link>}
120+
startIcon="info"
121+
startIconActive
122+
styleVariant="inline"
123+
title="Rounded inline banner"
124+
variant="promotional"
125+
>
126+
<TextLabel2 as="p">
127+
You can incrementally increase the radius to match surrounding cards or panels.
128+
</TextLabel2>
129+
</Banner>
130+
</VStack>
131+
```
132+
133+
:::tip
134+
Avoid setting `borderRadius` for `styleVariant="global"` so the vertical status bar remains aligned.
135+
:::

packages/common/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
88

99
<!-- template-start -->
1010

11+
## 8.22.1 ((11/24/2025, 02:58 PM PST))
12+
13+
This is an artificial version bump with no new change.
14+
1115
## 8.22.0 ((11/24/2025, 10:45 AM PST))
1216

1317
This is an artificial version bump with no new change.

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coinbase/cds-common",
3-
"version": "8.22.0",
3+
"version": "8.22.1",
44
"description": "Coinbase Design System - Common",
55
"repository": {
66
"type": "git",

packages/mcp-server/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
88

99
<!-- template-start -->
1010

11+
## 8.22.1 ((11/24/2025, 02:58 PM PST))
12+
13+
This is an artificial version bump with no new change.
14+
1115
## 8.22.0 ((11/24/2025, 10:45 AM PST))
1216

1317
This is an artificial version bump with no new change.

packages/mcp-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coinbase/cds-mcp-server",
3-
"version": "8.22.0",
3+
"version": "8.22.1",
44
"description": "Coinbase Design System - MCP Server",
55
"repository": {
66
"type": "git",

packages/mobile/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
88

99
<!-- template-start -->
1010

11+
## 8.22.1 (11/24/2025 PST)
12+
13+
#### 🐞 Fixes
14+
15+
- Fix the borderRadius prop issue in Banner. [[#190](https://github.com/coinbase/cds/pull/190)]
16+
1117
## 8.22.0 (11/24/2025 PST)
1218

1319
#### 🚀 Updates

packages/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coinbase/cds-mobile",
3-
"version": "8.22.0",
3+
"version": "8.22.1",
44
"description": "Coinbase Design System - Mobile",
55
"repository": {
66
"type": "git",

packages/mobile/src/banner/Banner.tsx

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { forwardRef, isValidElement, memo, useCallback, useMemo, useState } from 'react';
2-
import type { View, ViewStyle } from 'react-native';
2+
import type { View } from 'react-native';
33
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
44
import { variants } from '@coinbase/cds-common/tokens/banner';
55
import type {
@@ -8,33 +8,16 @@ import type {
88
IconName,
99
SharedProps,
1010
} from '@coinbase/cds-common/types';
11-
import { isDevelopment } from '@coinbase/cds-utils';
1211

1312
import { Collapsible } from '../collapsible/Collapsible';
1413
import { useTheme } from '../hooks/useTheme';
1514
import { Icon } from '../icons';
1615
import type { HStackProps } from '../layout';
1716
import { Box, HStack, VStack } from '../layout';
1817
import { Pressable } from '../system/Pressable';
19-
import type { LinkProps } from '../typography';
2018
import { Link } from '../typography';
2119
import { Text } from '../typography/Text';
2220

23-
const variantStyleProps: Record<BannerStyleVariant, HStackProps> = {
24-
contextual: {
25-
paddingX: 2,
26-
borderRadius: 400,
27-
},
28-
global: {
29-
paddingX: 3,
30-
borderRadius: undefined,
31-
},
32-
inline: {
33-
paddingX: 3,
34-
borderRadius: undefined,
35-
},
36-
};
37-
3821
export type BannerBaseProps = SharedProps & {
3922
/** Sets the variant of the banner - which is responsible for foreground and background color assignment */
4023
variant: BannerVariant;
@@ -79,7 +62,8 @@ export type BannerBaseProps = SharedProps & {
7962
bordered?: boolean;
8063
/**
8164
* Determines banner's border radius
82-
* @default 400
65+
*
66+
* @default 400 for contextual, undefined for global and inline
8367
* */
8468
borderRadius?: ThemeVars.BorderRadius;
8569
};
@@ -105,7 +89,7 @@ export const Banner = memo(
10589
styleVariant = 'contextual',
10690
startIconAccessibilityLabel,
10791
closeAccessibilityLabel = 'close',
108-
borderRadius = 400,
92+
borderRadius = styleVariant === 'contextual' ? 400 : undefined,
10993
margin,
11094
marginX,
11195
marginY,
@@ -197,10 +181,10 @@ export const Banner = memo(
197181
background={background}
198182
borderRadius={borderRadius}
199183
gap={1}
184+
paddingX={styleVariant === 'contextual' ? 2 : 3}
200185
paddingY={2}
201186
style={style}
202187
testID={testID}
203-
{...variantStyleProps[styleVariant]}
204188
{...props}
205189
>
206190
{/** Start */}

packages/mobile/src/banner/__stories__/Banner.stories.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const examplePropsWithOffset: ExampleProps = {
4141
children: 'Lorem ipsum dolar sit amet',
4242
};
4343

44+
const borderRadiusValues = [0, 200, 400] as const;
45+
4446
const styleProps: MobileBannerProps[] = [
4547
{
4648
variant: 'warning',
@@ -308,6 +310,39 @@ const BannerScreen = () => {
308310
/>
309311
</VStack>
310312
</Example>
313+
<Example title="Border Radius">
314+
<VStack gap={2}>
315+
<Text font="title1">Contextual</Text>
316+
<VStack gap={2}>
317+
{borderRadiusValues.map((radius) => (
318+
<Banner
319+
key={`mobile-contextual-${radius}`}
320+
{...exampleProps}
321+
borderRadius={radius}
322+
title={`Contextual radius ${radius}`}
323+
variant="informational"
324+
>
325+
{shortMessage}
326+
</Banner>
327+
))}
328+
</VStack>
329+
<Text font="title1">Inline</Text>
330+
<VStack gap={2}>
331+
{borderRadiusValues.map((radius) => (
332+
<Banner
333+
key={`mobile-inline-${radius}`}
334+
{...exampleProps}
335+
borderRadius={radius}
336+
styleVariant="inline"
337+
title={`Inline radius ${radius}`}
338+
variant="informational"
339+
>
340+
{shortMessage}
341+
</Banner>
342+
))}
343+
</VStack>
344+
</VStack>
345+
</Example>
311346
</ExampleScreen>
312347
);
313348
};

0 commit comments

Comments
 (0)