Skip to content

Commit

Permalink
fixup! Feat(web-react): Introduce Box component #DS-1595
Browse files Browse the repository at this point in the history
  • Loading branch information
curdaj committed Dec 31, 2024
1 parent dc0fb7f commit c7b431b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
11 changes: 2 additions & 9 deletions packages/web-react/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@ const Box = <T extends ElementType = 'div'>(props: SpiritBoxProps<T>) => {
const propsWithDefaults = { ...defaultProps, ...props };
const { elementType: ElementTag = 'div', children, ...restProps } = propsWithDefaults;

const { classProps, props: modifiedProps, styleProps: boxStyle } = useBoxStyleProps(restProps);
const { classProps, props: modifiedProps } = useBoxStyleProps(restProps);
const { styleProps, props: otherProps } = useStyleProps(modifiedProps);

const boxStyleProps = {
style: {
...styleProps.style,
...boxStyle,
},
};

return (
<ElementTag {...otherProps} {...boxStyleProps} className={classNames(classProps, styleProps.className)}>
<ElementTag {...otherProps} {...styleProps} className={classNames(classProps, styleProps.className)}>
{children}
</ElementTag>
);
Expand Down
5 changes: 0 additions & 5 deletions packages/web-react/src/components/Box/useBoxStyleProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export interface UseBoxStyleProps<T> {
classProps: string;
/** Props for the box element. */
props: T;
/** Style props for the box element */
styleProps: BoxCSSProperties;
}

export const generateResponsiveUtilityClasses = (
Expand Down Expand Up @@ -52,8 +50,6 @@ export const useBoxStyleProps = (
paddingY,
...restProps
} = props || {};
const boxStyle: BoxCSSProperties = {};

const boxBackgroundColor = backgroundColor ? `bg-${backgroundColor}` : '';
let boxBorderColor = borderColor ? borderColor.replace('', 'border-') : '';
let boxBorderRadius = '';
Expand Down Expand Up @@ -90,6 +86,5 @@ export const useBoxStyleProps = (
return {
classProps: boxClasses,
props: restProps,
styleProps: boxStyle,
};
};

0 comments on commit c7b431b

Please sign in to comment.