Skip to content

Commit

Permalink
refactor(common): move SwitchBase to common folder
Browse files Browse the repository at this point in the history
  • Loading branch information
WesSouza authored and arturbien committed Aug 5, 2022
1 parent cfe475d commit 746e9c0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import styled, { css } from 'styled-components';

import { createHatchedBackground } from '../common';
import useControlledOrUncontrolled from '../common/hooks/useControlledOrUncontrolled';
import { noOp } from '../common/utils';
import { StyledMenuListItem } from '../MenuList/MenuList';
import { StyledScrollView } from '../ScrollView/ScrollView';
import {
LabelText,
size,
StyledInput,
StyledLabel
} from '../SwitchBase/SwitchBase';
} from '../common/SwitchBase';
import { noOp } from '../common/utils';
import { StyledMenuListItem } from '../MenuList/MenuList';
import { StyledScrollView } from '../ScrollView/ScrollView';
import { CommonThemeProps } from '../types';

type CheckboxProps = {
Expand Down
6 changes: 3 additions & 3 deletions src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, { forwardRef } from 'react';
import styled, { css, CSSProperties } from 'styled-components';

import { createFlatBoxStyles } from '../common';
import { StyledMenuListItem } from '../MenuList/MenuList';
import { StyledScrollView } from '../ScrollView/ScrollView';
import {
LabelText,
size,
StyledInput,
StyledLabel
} from '../SwitchBase/SwitchBase';
} from '../common/SwitchBase';
import { StyledMenuListItem } from '../MenuList/MenuList';
import { StyledScrollView } from '../ScrollView/ScrollView';
import { CommonStyledProps } from '../types';

type RadioVariant = 'default' | 'flat' | 'menu';
Expand Down
2 changes: 1 addition & 1 deletion src/SwitchBase/SwitchBase.ts → src/common/SwitchBase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled, { css } from 'styled-components';

import { createDisabledTextStyles, focusOutline } from '../common';
import { createDisabledTextStyles, focusOutline } from '.';
import { StyledMenuListItem } from '../MenuList/MenuList';

export const size = 20;
Expand Down
10 changes: 2 additions & 8 deletions src/common/hooks/useForkRef.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ describe('useForkRef', () => {
});

it('forks if only one of the branches requires a ref', () => {
const Component = React.forwardRef<HTMLDivElement>(function Component(
_,
ref
) {
const Component = React.forwardRef<HTMLDivElement>((_, ref) => {
const [hasRef, setHasRef] = useState(false);
const handleOwnRef = useCallback(() => setHasRef(true), []);
const handleRef = useForkRef(handleOwnRef, ref);
Expand All @@ -60,10 +57,7 @@ describe('useForkRef', () => {
children: React.ReactElement;
};

const Outer = React.forwardRef<null, OuterProps>(function Outer(
props,
ref
) {
const Outer = React.forwardRef<null, OuterProps>((props, ref) => {
const { children } = props;

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

0 comments on commit 746e9c0

Please sign in to comment.