Skip to content

Commit

Permalink
Feat/replies (#297)
Browse files Browse the repository at this point in the history
* update db schema

* feat: add replies
  • Loading branch information
nikhilsnayak authored Nov 30, 2024
1 parent 6080b9e commit 6f22a95
Show file tree
Hide file tree
Showing 10 changed files with 933 additions and 180 deletions.
28 changes: 28 additions & 0 deletions components/list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ComponentProps, ReactNode } from 'react';

export function List<
T extends {
id: string | number;
},
>({
items,
children,
emptyListFallback,
...rest
}: Omit<ComponentProps<'ul'>, 'children'> & {
items: T[];
children: (item: T) => ReactNode;
emptyListFallback?: ReactNode;
}) {
if (items.length === 0) {
return emptyListFallback ?? null;
}

return (
<ul {...rest}>
{items.map((item) => (
<li key={item.id}>{children(item)}</li>
))}
</ul>
);
}
Loading

1 comment on commit 6f22a95

@vercel
Copy link

@vercel vercel bot commented on 6f22a95 Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.