Skip to content

Commit

Permalink
chore: createInterpolation 관련 코드를 롤백한다
Browse files Browse the repository at this point in the history
  • Loading branch information
pott-101 committed Jun 3, 2024
1 parent 0f40d52 commit ae3cf98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ const pseudoHoverProp = createSystemProp({
shouldInterpolation: 'before',
});

describe.skip('createInterpolation', () => {
describe('createInterpolation', () => {
const { theme } = useCurrentTheme();

const interpolation = createInterpolation([widthProp, heightProp, marginProp, pseudoHoverProp])({
theme,
breakpointIndex: 0,
});
// eslint-disable-next-line @typescript-eslint/naming-convention

let props: Record<string, any>;

describe('when prop is 1 depth object', () => {
Expand All @@ -55,7 +55,7 @@ describe.skip('createInterpolation', () => {
});

it('systemProp return value is merged by media query key', () => {
expect(interpolation).toStrictEqual({
expect(interpolation(props)).toStrictEqual({
width: 100,
height: 100,
'@media screen and (min-width: 640px)': {
Expand All @@ -72,7 +72,7 @@ describe.skip('createInterpolation', () => {
});

it('should removed non-systemProp key', () => {
expect(interpolation).toStrictEqual({ width: 100 });
expect(interpolation(props)).toStrictEqual({ width: 100 });
});
});

Expand All @@ -82,7 +82,7 @@ describe.skip('createInterpolation', () => {
});

it('should return empty object', () => {
expect(interpolation).toStrictEqual({});
expect(interpolation(props)).toStrictEqual({});
});
});

Expand All @@ -92,7 +92,7 @@ describe.skip('createInterpolation', () => {
});

it('should return empty object', () => {
expect(interpolation).toStrictEqual({});
expect(interpolation(props)).toStrictEqual({});
});
});
});
Expand All @@ -103,7 +103,7 @@ describe.skip('createInterpolation', () => {
});

it('should return return value of all nested systemProp', () => {
expect(interpolation).toStrictEqual({
expect(interpolation(props)).toStrictEqual({
'&:hover': { margin: 3 },
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from 'react';
import type { CurrentTheme } from '@vibrant-ui/theme';
import { isDefined, isRecord } from '@vibrant-ui/utils';
import type { SystemProp } from '../createSystemProp';
Expand Down Expand Up @@ -48,7 +49,7 @@ export const createInterpolation = (systemProps: SystemProp[], defaultProps: any
};

return ({ theme, props }: { theme: CurrentTheme; props: Record<string, any> }) => {
const interpolationResult = childInterpolation({ ...defaultProps, ...props }, theme);
const interpolationResult = useMemo(() => childInterpolation({ ...defaultProps, ...props }, theme), [props, theme]);

return useBuildStyle({ styleObjects: interpolationResult, theme });
};
Expand Down

0 comments on commit ae3cf98

Please sign in to comment.