Initial frontend draft
This commit is contained in:
parent
1606d1faf0
commit
b6293beeec
21 changed files with 4105 additions and 150 deletions
32
frontend/app/routes/Libraries.tsx
Normal file
32
frontend/app/routes/Libraries.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import LibraryCard from "~/Components/Libraries/LibraryCard";
|
||||
import { FetchLibraries } from "~/Lib/Library";
|
||||
import type Library from "~/Models/Library";
|
||||
|
||||
export const meta = () => {
|
||||
return [
|
||||
{ title: "New React Router App" },
|
||||
];
|
||||
};
|
||||
|
||||
const Libraries = () => {
|
||||
const [libraries, setLibraries] = useState<Array<Library>>([]);
|
||||
|
||||
useEffect(() => {
|
||||
FetchLibraries().then(response => {
|
||||
setLibraries(response);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{libraries.length > 0 && libraries.map(library => {
|
||||
return (
|
||||
<LibraryCard library={library} key={library.id} />
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Libraries;
|
||||
Loading…
Add table
Add a link
Reference in a new issue