-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 31 additions & 31 deletions
62
apps/palette/web/src/components/projects/ProjectsList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
import { hooks } from '@/hooks.js'; | ||
import { Project } from '@palette.biscuits/verdant'; | ||
import { | ||
CardRoot, | ||
CardMain, | ||
CardGrid, | ||
CardImage, | ||
CardRoot, | ||
CardMain, | ||
CardGrid, | ||
CardImage, | ||
} from '@a-type/ui/components/card'; | ||
import { InfiniteLoadTrigger } from '@a-type/ui/components/infiniteLoadTrigger'; | ||
import { Link } from '@verdant-web/react-router'; | ||
|
||
export interface ProjectsListProps {} | ||
|
||
export function ProjectsList({}: ProjectsListProps) { | ||
const [items, { hasMore, loadMore }] = hooks.useAllProjectsInfinite({ | ||
index: { | ||
where: 'createdAt', | ||
order: 'desc', | ||
}, | ||
pageSize: 20, | ||
}); | ||
const [items, { hasMore, loadMore }] = hooks.useAllProjectsInfinite({ | ||
index: { | ||
where: 'createdAt', | ||
order: 'desc', | ||
}, | ||
pageSize: 20, | ||
}); | ||
|
||
return ( | ||
<> | ||
<CardGrid> | ||
{items.map((item, i) => ( | ||
<ProjectsListItem item={item} key={i} /> | ||
))} | ||
</CardGrid> | ||
{hasMore && <InfiniteLoadTrigger onVisible={loadMore} />} | ||
</> | ||
); | ||
return ( | ||
<> | ||
<CardGrid> | ||
{items.map((item, i) => ( | ||
<ProjectsListItem item={item} key={i} /> | ||
))} | ||
</CardGrid> | ||
{hasMore && <InfiniteLoadTrigger onVisible={loadMore} />} | ||
</> | ||
); | ||
} | ||
|
||
function ProjectsListItem({ item }: { item: Project }) { | ||
const { id, image } = hooks.useWatch(item); | ||
hooks.useWatch(image); | ||
return ( | ||
<CardRoot className="h-240px"> | ||
<CardMain asChild> | ||
<Link to={`/projects/${id}`} /> | ||
</CardMain> | ||
<CardImage asChild>{image.url && <img src={image.url} />}</CardImage> | ||
</CardRoot> | ||
); | ||
const { id, image } = hooks.useWatch(item); | ||
hooks.useWatch(image); | ||
return ( | ||
<CardRoot className="h-240px"> | ||
<CardMain asChild> | ||
<Link to={`/projects/${id}`} /> | ||
</CardMain> | ||
<CardImage asChild>{image.url && <img src={image.url} />}</CardImage> | ||
</CardRoot> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createOnboarding } from '@biscuits/client'; | ||
|
||
export const basicsOnboarding = createOnboarding( | ||
'basics', | ||
['intro', 'bubbles', 'color', 'palette'], | ||
true, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters