Skip to content

Commit

Permalink
fix: forwardref on Block
Browse files Browse the repository at this point in the history
  • Loading branch information
maxholman committed Jan 16, 2023
1 parent 4f18c5f commit 5f3c657
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ export type BlockProps<T extends keyof ReactHTMLAttributesHacked> = Merge<
}
>;

export const Block = <T extends keyof ReactHTMLAttributesHacked = 'div'>({
component = 'div',
space = 'large',
className,
...props
}: BlockProps<T>) => (
const BlockInner = <T extends keyof ReactHTMLAttributesHacked = 'div'>(
{ space = 'large', className, component = 'div', ...props }: BlockProps<T>,
ref: ForwardedRef<ReactHTMLElementsHacked[T]>,
): ReactElement | null => (
<Box
component={component}
{...props}
className={[flexColumnVariants[space], className]}
component={component}
ref={ref}
/>
);

export const Block = forwardRef(BlockInner);

export type InlineProps<T extends keyof ReactHTMLAttributesHacked> = Merge<
BoxBasedComponentProps<T>,
{
Expand Down

0 comments on commit 5f3c657

Please sign in to comment.