diff --git a/app/routes/posts/route.tsx b/app/routes/posts/route.tsx index cd4105b..b5e1360 100644 --- a/app/routes/posts/route.tsx +++ b/app/routes/posts/route.tsx @@ -6,11 +6,16 @@ import { useLoaderData } from "@remix-run/react"; import { json } from "@remix-run/node"; import PostsListPage from "@/src/posts/presentation/pages/posts-list/posts-list"; +import { usePostsListProvider } from "@/src/posts/presentation/providers/posts-list.provider"; export default function PostsPage() { const data = useLoaderData(); - return ; + return ( + + + + ); } export async function loader() { diff --git a/src/posts/presentation/pages/posts-list/posts-list.tsx b/src/posts/presentation/pages/posts-list/posts-list.tsx index ca6fc3d..a8bae2a 100644 --- a/src/posts/presentation/pages/posts-list/posts-list.tsx +++ b/src/posts/presentation/pages/posts-list/posts-list.tsx @@ -1,10 +1,12 @@ import css from "@/src/shared/presentation/styles/wrapper.css"; import { SimpleCard } from "@/src/shared/presentation/components/simple-card/simple-card"; -import type { Post } from "@/src/posts/domain/models/post"; import { useTranslation } from "react-i18next"; import PageTitle from "@/src/shared/presentation/components/page-title/page-title"; +import { usePostsListProvider } from "../../providers/posts-list.provider"; + +export default function PostsPage() { + const posts = usePostsListProvider((state) => state.posts); -export default function PostsPage({ posts }: { posts: Array }) { const { t } = useTranslation(); return ( diff --git a/src/posts/presentation/providers/posts-list.provider.ts b/src/posts/presentation/providers/posts-list.provider.ts new file mode 100644 index 0000000..01aa352 --- /dev/null +++ b/src/posts/presentation/providers/posts-list.provider.ts @@ -0,0 +1,6 @@ +import { createProvider } from "@/src/shared/presentation/utils/zustand"; +import type { PostsListStateViewModel } from "../view-models/posts-list-state"; + +export const usePostsListProvider = createProvider(() => (_set) => ({ + posts: [] +})); diff --git a/src/posts/presentation/view-models/posts-list-state.ts b/src/posts/presentation/view-models/posts-list-state.ts new file mode 100644 index 0000000..1b408a5 --- /dev/null +++ b/src/posts/presentation/view-models/posts-list-state.ts @@ -0,0 +1,5 @@ +import type { Post } from "@/src/posts/domain/models/post"; + +export interface PostsListStateViewModel { + posts: Array; +}