Skip to content

Commit

Permalink
Fix Later - Run Script only on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
Kawtar Choubari committed Sep 25, 2023
1 parent cfd8c29 commit c32ee2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Blog() {
<p>The one and the only place to read my confessions.</p>
</div>
{posts?.length ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4 mx-4 my-6">
{posts.map((post, idx) => (
<PostCard key={idx} {...post} />
))}
Expand Down
11 changes: 3 additions & 8 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Providers } from "@/lib/provider";
import Footer from "@/components/footer";
import { siteConfig } from "@/config/site";
import Analytics from "@/components/analytics";
import { isDesktop, isMobile } from "react-device-detect";
import { isDesktop } from "react-device-detect";

export const metadata = {
title: siteConfig.name,
Expand Down Expand Up @@ -63,8 +63,6 @@ export default function RootLayout({
}: {
children: React.ReactNode;
}) {
console.log("isMobile ", isMobile);
console.log("isDesktop ", isDesktop);
return (
<html lang="en" suppressHydrationWarning={true}>
<body
Expand All @@ -81,10 +79,7 @@ export default function RootLayout({
<Footer />
{/* TODO: replace with html script tag as the Nextjs Script didn't work */}
{/* TODO: load this script only on desktop */}
<h1 className="text-xl font-bold">
isDesktop{":" + isDesktop}, isMobile{":" + isMobile}
</h1>
{isDesktop && (
{/* {isDesktop && (
<script
data-name="BMC-Widget"
data-cfasync="false"
Expand All @@ -98,7 +93,7 @@ export default function RootLayout({
data-y_margin="18"
// strategy="lazyOnload"
></script>
)}
)} */}
</body>
</html>
);
Expand Down

0 comments on commit c32ee2f

Please sign in to comment.