Skip to content

Commit

Permalink
refactor CardMasonry
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Nov 28, 2022
1 parent a2fc203 commit b2c3e0f
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/components/molecules/cardMasonry.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx';
import { MasonryProps, RenderComponentProps } from 'masonic';
import { MasonryProps } from 'masonic';
import React from 'react';
import dynamic from 'next/dynamic';

Expand All @@ -12,26 +12,15 @@ const Masonry = dynamic<MasonryProps<unknown>>(
}
);

type Props<T> = {
items: T[];
render: React.ComponentType<RenderComponentProps<T>>;
className?: string;
};

export default function CardMasonry<T>({
className,
items,
render,
}: Props<T>): JSX.Element {
export default function CardMasonry<T>(props: MasonryProps<T>): JSX.Element {
return (
<Masonry
items={items}
render={
render as unknown as React.ComponentType<RenderComponentProps<unknown>>
}
className={clsx(styles.base, className)}
columnGutter={20}
columnWidth={300}
{...{
columnGutter: 20,
columnWidth: 300,
...(props as MasonryProps<unknown>),
className: clsx(styles.base, props.className),
}}
/>
);
}

0 comments on commit b2c3e0f

Please sign in to comment.