Skip to content

Commit 4203b46

Browse files
committed
Simplify degree suffix
1 parent f76881d commit 4203b46

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

packages/components/src/angle-picker-control/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { isRTL, __ } from '@wordpress/i18n';
1616
import { Flex, FlexBlock } from '../flex';
1717
import { Spacer } from '../spacer';
1818
import NumberControl from '../number-control';
19-
import { Text } from '../text';
19+
import InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';
20+
import InputControlSuffixWrapper from '../input-control/input-suffix-wrapper';
2021
import AngleCircle from './angle-circle';
21-
import styles from './style.module.scss';
2222

2323
import type { WordPressComponentProps } from '../context';
2424
import type { AnglePickerControlProps } from './types';
@@ -49,10 +49,9 @@ function UnforwardedAnglePickerControl(
4949

5050
const classes = clsx( 'components-angle-picker-control', className );
5151

52-
const unitText = <Text className={ styles[ 'unit-text' ] }>°</Text>;
53-
const [ prefixedUnitText, suffixedUnitText ] = isRTL()
54-
? [ unitText, null ]
55-
: [ null, unitText ];
52+
const prefixOrSuffixProp = isRTL()
53+
? { prefix: <InputControlPrefixWrapper>°</InputControlPrefixWrapper> }
54+
: { suffix: <InputControlSuffixWrapper>°</InputControlSuffixWrapper> };
5655

5756
return (
5857
<Flex { ...restProps } ref={ ref } className={ classes } gap={ 2 }>
@@ -67,8 +66,7 @@ function UnforwardedAnglePickerControl(
6766
step="1"
6867
value={ value }
6968
spinControls="none"
70-
prefix={ prefixedUnitText }
71-
suffix={ suffixedUnitText }
69+
{ ...prefixOrSuffixProp }
7270
/>
7371
</FlexBlock>
7472
<Spacer marginBottom="1" marginTop="auto">

packages/components/src/angle-picker-control/style.module.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,3 @@
3838
width: 6px;
3939
height: 6px;
4040
}
41-
42-
.unit-text {
43-
color: $components-color-accent;
44-
margin-right: $grid-unit-15;
45-
}
46-

0 commit comments

Comments
 (0)