Skip to content

Commit 746e9c0

Browse files
WesSouzaarturbien
authored andcommitted
refactor(common): move SwitchBase to common folder
1 parent cfe475d commit 746e9c0

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

src/Checkbox/Checkbox.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import styled, { css } from 'styled-components';
33

44
import { createHatchedBackground } from '../common';
55
import useControlledOrUncontrolled from '../common/hooks/useControlledOrUncontrolled';
6-
import { noOp } from '../common/utils';
7-
import { StyledMenuListItem } from '../MenuList/MenuList';
8-
import { StyledScrollView } from '../ScrollView/ScrollView';
96
import {
107
LabelText,
118
size,
129
StyledInput,
1310
StyledLabel
14-
} from '../SwitchBase/SwitchBase';
11+
} from '../common/SwitchBase';
12+
import { noOp } from '../common/utils';
13+
import { StyledMenuListItem } from '../MenuList/MenuList';
14+
import { StyledScrollView } from '../ScrollView/ScrollView';
1515
import { CommonThemeProps } from '../types';
1616

1717
type CheckboxProps = {

src/Radio/Radio.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React, { forwardRef } from 'react';
22
import styled, { css, CSSProperties } from 'styled-components';
33

44
import { createFlatBoxStyles } from '../common';
5-
import { StyledMenuListItem } from '../MenuList/MenuList';
6-
import { StyledScrollView } from '../ScrollView/ScrollView';
75
import {
86
LabelText,
97
size,
108
StyledInput,
119
StyledLabel
12-
} from '../SwitchBase/SwitchBase';
10+
} from '../common/SwitchBase';
11+
import { StyledMenuListItem } from '../MenuList/MenuList';
12+
import { StyledScrollView } from '../ScrollView/ScrollView';
1313
import { CommonStyledProps } from '../types';
1414

1515
type RadioVariant = 'default' | 'flat' | 'menu';

src/SwitchBase/SwitchBase.ts renamed to src/common/SwitchBase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled, { css } from 'styled-components';
22

3-
import { createDisabledTextStyles, focusOutline } from '../common';
3+
import { createDisabledTextStyles, focusOutline } from '.';
44
import { StyledMenuListItem } from '../MenuList/MenuList';
55

66
export const size = 20;

src/common/hooks/useForkRef.spec.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ describe('useForkRef', () => {
3636
});
3737

3838
it('forks if only one of the branches requires a ref', () => {
39-
const Component = React.forwardRef<HTMLDivElement>(function Component(
40-
_,
41-
ref
42-
) {
39+
const Component = React.forwardRef<HTMLDivElement>((_, ref) => {
4340
const [hasRef, setHasRef] = useState(false);
4441
const handleOwnRef = useCallback(() => setHasRef(true), []);
4542
const handleRef = useForkRef(handleOwnRef, ref);
@@ -60,10 +57,7 @@ describe('useForkRef', () => {
6057
children: React.ReactElement;
6158
};
6259

63-
const Outer = React.forwardRef<null, OuterProps>(function Outer(
64-
props,
65-
ref
66-
) {
60+
const Outer = React.forwardRef<null, OuterProps>((props, ref) => {
6761
const { children } = props;
6862

6963
// TODO: Fix this test as reading ref from children is not allowed so not available on React types

0 commit comments

Comments
 (0)