Skip to content

Commit dbcec2d

Browse files
authored
chore: Fix border radius bug on segmented-control (#4398)
1 parent 1a54c66 commit dbcec2d

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

pages/theming/themed-stroke-width.page.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
InputProps,
1414
KeyValuePairs,
1515
Link,
16+
SegmentedControl,
1617
Select,
1718
SelectProps,
1819
SpaceBetween,
@@ -72,6 +73,7 @@ export default function ThemedStrokeWidthPage() {
7273
borderWidthIconMedium: strokeMedium ? `${strokeMedium}px` : '1px',
7374
borderWidthIconBig: strokeBig ? `${strokeBig}px` : '1.5px',
7475
borderWidthIconLarge: strokeLarge ? `${strokeLarge}px` : '2px',
76+
borderRadiusButton: '8px',
7577
},
7678
};
7779

@@ -84,6 +86,8 @@ export default function ThemedStrokeWidthPage() {
8486
return reset;
8587
}, [themed, strokeSmall, strokeNormal, strokeMedium, strokeBig, strokeLarge]);
8688

89+
const [selectedId, setSelectedId] = React.useState('seg-1');
90+
8791
return (
8892
<div style={{ padding: 15 }}>
8993
<h1>Themed icon stroke width</h1>
@@ -220,6 +224,17 @@ export default function ThemedStrokeWidthPage() {
220224
</Button>
221225
</div>
222226

227+
<SegmentedControl
228+
selectedId={selectedId}
229+
onChange={({ detail }) => setSelectedId(detail.selectedId)}
230+
label="Default segmented control"
231+
options={[
232+
{ text: 'Segment 1', id: 'seg-1' },
233+
{ text: 'Segment 2', id: 'seg-2' },
234+
{ text: 'Segment 3', id: 'seg-3' },
235+
]}
236+
/>
237+
223238
<div>
224239
<Link external={true} href="https://example.com/" variant="primary">
225240
Learn more

src/segmented-control/segment.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $selected-background: var(#{custom-props.$styleBackgroundActive}, awsui.$color-b
2121
$selected-color: var(#{custom-props.$styleColorActive}, awsui.$color-text-segment-active);
2222
$segment-gap: awsui.$space-static-xxs;
2323
$segment-divider-width: 1px;
24+
$segment-radius: calc(awsui.$border-radius-button - 3px);
2425

2526
.segment {
2627
@include styles.font-body-m;
@@ -34,10 +35,10 @@ $segment-divider-width: 1px;
3435
color: $default-color;
3536
overflow: visible;
3637

37-
border-start-start-radius: awsui.$border-radius-button;
38-
border-start-end-radius: awsui.$border-radius-button;
39-
border-end-start-radius: awsui.$border-radius-button;
40-
border-end-end-radius: awsui.$border-radius-button;
38+
border-start-start-radius: $segment-radius;
39+
border-start-end-radius: $segment-radius;
40+
border-end-start-radius: $segment-radius;
41+
border-end-end-radius: $segment-radius;
4142

4243
position: relative;
4344
block-size: calc(100% - $segment-gap);

0 commit comments

Comments
 (0)