From e3736b3273453cc6681416d0058410a5680401aa Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Tue, 18 Jul 2023 17:27:38 +1000 Subject: [PATCH 1/2] initial implementation of passing name to blog --- .../components/FileRenderer/FileContainer.tsx | 9 +++--- next/src/pages/blog/[bid].tsx | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/frontend/src/packages/dashboard/components/FileRenderer/FileContainer.tsx b/frontend/src/packages/dashboard/components/FileRenderer/FileContainer.tsx index 38fe094eb..f56c7e4e7 100644 --- a/frontend/src/packages/dashboard/components/FileRenderer/FileContainer.tsx +++ b/frontend/src/packages/dashboard/components/FileRenderer/FileContainer.tsx @@ -48,12 +48,13 @@ function FileContainer({ name, id, selectedFile, setSelectedFile }: Props) { console.log(id); setSelectedFile(id); if (selectedFile !== null) { - navigate("/editor/" + selectedFile, { + navigate("/editor/" + selectedFile, { replace: false, state: { - filename: name - } - }), [navigate]; + filename: name, + }, + }), + [navigate]; } }; diff --git a/next/src/pages/blog/[bid].tsx b/next/src/pages/blog/[bid].tsx index 4b52d12e7..e77c2a13d 100644 --- a/next/src/pages/blog/[bid].tsx +++ b/next/src/pages/blog/[bid].tsx @@ -22,7 +22,11 @@ const MainContainer = styled.div` min-height: 80vh; `; -const BlogPage: NextPage<{ data: Block[] }> = ({ data }) => { +const BlogPage: NextPage<{ data: Block[]; blogName: any }> = ({ + data, + blogName, +}) => { + console.log("data", data); return ( = ({ data }) => { />{" "} {/** ignore the styling */} - Blog Title + {blogName}