Commit d3b8a857 by Madhankumar

code changes

parent f0939df5
import SingleBlog from "@components/top-level/single-blog"; import SingleBlog from "@components/top-level/single-blog";
import Loading from "app/loading";
import { getPostById } from "@lib/api"; import { getPostById } from "@lib/api";
const SingleBlogApp = async ({ params: { id } }) => { const SingleBlogApp = async ({ params: { id } }) => {
const blog = await getPostById("posts", id); const blog = await getPostById("posts", id);
return <div>{blog ? <SingleBlog {...blog} /> : <Loading />}</div>; return <SingleBlog {...blog} />;
}; };
export default SingleBlogApp; export default SingleBlogApp;
...@@ -41,7 +41,7 @@ function Header({ ...@@ -41,7 +41,7 @@ function Header({
<div onClick={handleTheme} className={styles.themeLight}> <div onClick={handleTheme} className={styles.themeLight}>
<Icons <Icons
name={currentTheme === "light" ? "sun" : "moon"} name={currentTheme === "light" ? "moon" : "sun"}
size="large" size="large"
/> />
</div> </div>
......
...@@ -9,7 +9,7 @@ export const ThemeProvider = ({ children }) => { ...@@ -9,7 +9,7 @@ export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState("light"); const [theme, setTheme] = useState("light");
useEffect(() => { useEffect(() => {
const storedTheme = localStorage.getItem("theme") || "light"; const storedTheme = localStorage.getItem("theme");
setTheme(storedTheme); setTheme(storedTheme);
document.documentElement.setAttribute("class", storedTheme); document.documentElement.setAttribute("class", storedTheme);
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment