Skip to content

Commit

Permalink
feat(v2): animate file list
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatt committed Dec 3, 2023
1 parent 744c275 commit 376f806
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test": "vitest"
},
"dependencies": {
"@formkit/auto-animate": "0.8.1",
"@hookform/resolvers": "3.3.2",
"@radix-ui/react-label": "2.0.2",
"@radix-ui/react-navigation-menu": "1.1.4",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/components/FileList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useAutoAnimate } from '@formkit/auto-animate/react';
import { ListXIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { getFiles, useStore } from 'src/store';
Expand All @@ -9,10 +10,11 @@ export const FileList = () => {
const { t } = useTranslation();
const files = useStore(getFiles);
const clearFiles = useStore(state => state.clearFiles);
const [listRef] = useAutoAnimate();

return (
<div className="relative h-full">
<ul className="flex h-full flex-col gap-3 overflow-y-auto px-4 pb-14 pt-4">
<ul className="flex h-full flex-col gap-3 overflow-y-auto px-4 pb-14 pt-4" ref={listRef}>
{files.map(file => (
<li key={file.path}>
<FileCard file={file} />
Expand Down

0 comments on commit 376f806

Please sign in to comment.