Skip to content

Commit 066b192

Browse files
committed
AnglePickerColor: migrate Emotion to style.module
1 parent b9e9788 commit 066b192

File tree

4 files changed

+64
-72
lines changed

4 files changed

+64
-72
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import clsx from 'clsx';
5+
16
/**
27
* WordPress dependencies
38
*/
@@ -7,11 +12,7 @@ import { __experimentalUseDragging as useDragging } from '@wordpress/compose';
712
/**
813
* Internal dependencies
914
*/
10-
import {
11-
CircleRoot,
12-
CircleIndicatorWrapper,
13-
CircleIndicator,
14-
} from './styles/angle-picker-control-styles';
15+
import styles from './style.module.scss';
1516

1617
import type { WordPressComponentProps } from '../context';
1718
import type { AngleCircleProps } from './types';
@@ -25,6 +26,7 @@ type UseDraggingCallbackEvent =
2526
function AngleCircle( {
2627
value,
2728
onChange,
29+
className,
2830
...props
2931
}: WordPressComponentProps< AngleCircleProps, 'div' > ) {
3032
const angleCircleRef = useRef< HTMLDivElement | null >( null );
@@ -89,22 +91,23 @@ function AngleCircle( {
8991
}, [ isDragging ] );
9092

9193
return (
92-
<CircleRoot
94+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
95+
<div
9396
ref={ angleCircleRef }
9497
onMouseDown={ startDrag }
95-
className="components-angle-picker-control__angle-circle"
98+
className={ clsx( styles[ 'circle-root' ], className ) }
9699
{ ...props }
97100
>
98-
<CircleIndicatorWrapper
101+
<div
99102
style={
100103
value ? { transform: `rotate(${ value }deg)` } : undefined
101104
}
102-
className="components-angle-picker-control__angle-circle-indicator-wrapper"
105+
className={ styles[ 'circle-indicator-wrapper' ] }
103106
tabIndex={ -1 }
104107
>
105-
<CircleIndicator className="components-angle-picker-control__angle-circle-indicator" />
106-
</CircleIndicatorWrapper>
107-
</CircleRoot>
108+
<div className={ styles[ 'circle-indicator' ] } />
109+
</div>
110+
</div>
108111
);
109112
}
110113

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +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';
1920
import AngleCircle from './angle-circle';
20-
import { UnitText } from './styles/angle-picker-control-styles';
21+
import styles from './style.module.scss';
2122

2223
import type { WordPressComponentProps } from '../context';
2324
import type { AnglePickerControlProps } from './types';
@@ -48,7 +49,7 @@ function UnforwardedAnglePickerControl(
4849

4950
const classes = clsx( 'components-angle-picker-control', className );
5051

51-
const unitText = <UnitText>°</UnitText>;
52+
const unitText = <Text className={ styles[ 'unit-text' ] }>°</Text>;
5253
const [ prefixedUnitText, suffixedUnitText ] = isRTL()
5354
? [ unitText, null ]
5455
: [ null, unitText ];
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@use "@wordpress/base-styles/variables" as *;
2+
@use "../utils/theme-variables" as *;
3+
4+
.circle-root {
5+
border-radius: $radius-round;
6+
border: $border-width solid $components-color-border;
7+
box-sizing: border-box;
8+
cursor: grab;
9+
height: 32px;
10+
overflow: hidden;
11+
width: 32px;
12+
13+
&:active {
14+
cursor: grabbing;
15+
}
16+
}
17+
18+
.circle-indicator-wrapper {
19+
box-sizing: border-box;
20+
position: relative;
21+
width: 100%;
22+
height: 100%;
23+
24+
&:focus-visible {
25+
outline: none;
26+
}
27+
}
28+
29+
.circle-indicator {
30+
background: $components-color-accent;
31+
border-radius: $radius-round;
32+
box-sizing: border-box;
33+
display: block;
34+
left: 50%;
35+
top: 4px;
36+
transform: translateX(-50%);
37+
position: absolute;
38+
width: 6px;
39+
height: 6px;
40+
}
41+
42+
.unit-text {
43+
color: $components-color-accent;
44+
margin-right: 12px;
45+
}
46+

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

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)