diff --git a/src/Components/Templates/ItemsIndexPage.tsx b/src/Components/Templates/ItemsIndexPage.tsx new file mode 100644 index 00000000..06401d52 --- /dev/null +++ b/src/Components/Templates/ItemsIndexPage.tsx @@ -0,0 +1,82 @@ +import { useEffect, useState } from 'react' +import { Link } from 'react-router-dom'; +import { ItemsApi } from '../../types'; +import { getValue } from '../../Utils/GetValue'; +import { TitleCard } from './TitleCard'; + + +type breadcrumb = { + name: string, + path: string +} + + +export const ItemsIndexPage = ({ api, url, parameterField, breadcrumbs, itemNameField, itemTextField, itemImageField }: { api: ItemsApi, url: string, parameterField: string, breadcrumbs: Array, itemNameField: string, itemTextField: string, itemImageField: string }) => { + + + const [items, setItems] = useState(); + + const loadProjects = async () => { + const items = await api?.getItems(); + setItems(items as any); + } + + + useEffect(() => { + loadProjects(); + }, [api]) + + return ( +
+
+ {breadcrumbs && +
+
    + {breadcrumbs.map(b =>
  • {b.name}
  • )} +
+
} + {/** +
+ { setSearch(val) }}> + { }} placeholder="Type" containerStyle=' hidden md:grid' defaultValue='PLACEHOLDER' options={[{ name: "local", value: "local" }, { name: "project", value: "project" }]} /> +
+
+ + */} + + + +
+ { + items?.map((i, k) => { + return ( + + + +

{i.subname}

+ + +

{getValue(i,itemTextField)}

+ {/** + *
+
 2
+
 5
+
 9
+
+ + */} + + +
+ + ) + + }) + } +
+
+
+ + + ) +} diff --git a/src/Components/Templates/index.tsx b/src/Components/Templates/index.tsx index 9f4824de..74b21097 100644 --- a/src/Components/Templates/index.tsx +++ b/src/Components/Templates/index.tsx @@ -2,4 +2,5 @@ export {CardPage} from './CardPage' export {TitleCard} from './TitleCard' export {MapOverlayPage} from './MapOverlayPage' export {CircleLayout} from './CircleLayout' -export {MoonCalendar} from './MoonCalendar' \ No newline at end of file +export {MoonCalendar} from './MoonCalendar' +export {ItemsIndexPage} from "./ItemsIndexPage" diff --git a/src/index.tsx b/src/index.tsx index d8bc55d2..7d2933b7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,7 @@ export {AppShell, Content, SideBar} from "./Components/AppShell" export {AuthProvider, useAuth, LoginPage, SignupPage, RequestPasswordPage, SetNewPasswordPage} from "./Components/Auth" export {UserSettings, ProfileSettings, OverlayProfile, OverlayProfileSettings, OverlayUserSettings} from './Components/Profile' export {Quests, Modal} from './Components/Gaming' -export {TitleCard, CardPage, MapOverlayPage, CircleLayout, MoonCalendar} from './Components/Templates' +export {TitleCard, CardPage, MapOverlayPage, CircleLayout, MoonCalendar, ItemsIndexPage} from './Components/Templates' export {TextInput, TextAreaInput, SelectBox} from './Components/Input' import "./index.css"