website refactor
This commit is contained in:
@@ -45,9 +45,9 @@ export const Box = forwardRef(<T extends ElementType = 'div'>(
|
||||
maxWidth,
|
||||
...props
|
||||
}: BoxProps<T> & ComponentPropsWithoutRef<T>,
|
||||
ref: ForwardedRef<any>
|
||||
ref: ForwardedRef<HTMLElement>
|
||||
) => {
|
||||
const Tag = (as as any) || 'div';
|
||||
const Tag = (as as ElementType) || 'div';
|
||||
|
||||
const spacingMap: Record<string | number, string> = {
|
||||
0: '0', 0.5: '0.5', 1: '1', 1.5: '1.5', 2: '2', 2.5: '2.5', 3: '3', 3.5: '3.5', 4: '4',
|
||||
@@ -81,10 +81,10 @@ export const Box = forwardRef(<T extends ElementType = 'div'>(
|
||||
className
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
const style = maxWidth ? { maxWidth, ...((props as any).style || {}) } : (props as any).style;
|
||||
const style = maxWidth ? { maxWidth, ...((props as Record<string, unknown>).style as object || {}) } : (props as Record<string, unknown>).style;
|
||||
|
||||
return (
|
||||
<Tag ref={ref} className={classes} {...props} style={style}>
|
||||
<Tag ref={ref as React.ForwardedRef<HTMLElement>} className={classes} {...props} style={style as React.CSSProperties}>
|
||||
{children}
|
||||
</Tag>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user