Skip to content

Commit

Permalink
fix(with-facebook-pixel): prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
niko20 committed May 19, 2023
1 parent 5b04897 commit bd87c3a
Show file tree
Hide file tree
Showing 6 changed files with 5,415 additions and 5,016 deletions.
8 changes: 3 additions & 5 deletions examples/with-facebook-pixel/app/about/page.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Link from "next/link";
import Link from 'next/link'

export default function About() {
return (
<>
<h1>About</h1>

<Link href="/">
back to home
</Link>
<Link href="/">back to home</Link>
</>
);
)
}
26 changes: 13 additions & 13 deletions examples/with-facebook-pixel/app/components/FacebookPixel.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use client';
'use client'

import { usePathname } from 'next/navigation';
import Script from 'next/script';
import { useEffect, useState } from 'react';
import * as pixel from '/lib/fpixel';
import { usePathname } from 'next/navigation'
import Script from 'next/script'
import { useEffect, useState } from 'react'
import * as pixel from '/lib/fpixel'

const FacebookPixel = () => {
const [loaded, setLoaded] = useState(false);
const pathname = usePathname();
const [loaded, setLoaded] = useState(false)
const pathname = usePathname()

useEffect(() => {
if (!loaded) return;
if (!loaded) return

pixel.pageview();
}, [pathname, loaded]);
pixel.pageview()
}, [pathname, loaded])

return (
<div>
Expand All @@ -25,7 +25,7 @@ const FacebookPixel = () => {
data-pixel-id={pixel.FB_PIXEL_ID}
/>
</div>
);
};
)
}

export default FacebookPixel;
export default FacebookPixel
2 changes: 1 addition & 1 deletion examples/with-facebook-pixel/app/components/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as FacebookPixel } from './FacebookPixel';
export { default as FacebookPixel } from './FacebookPixel'
8 changes: 3 additions & 5 deletions examples/with-facebook-pixel/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { FacebookPixel } from './components';
import { FacebookPixel } from './components'

export default function RootLayout({
children,
}) {
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<FacebookPixel />
</body>
</html>
);
)
}
15 changes: 6 additions & 9 deletions examples/with-facebook-pixel/app/page.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import Link from "next/link";
import Link from 'next/link'

export default function Home() {
return (
<>
<h2>
Go to `app/layout.js` to see how implement Facebook Pixel in NextJS ˆ13 with app folder
Go to `app/layout.js` to see how implement Facebook Pixel in NextJS ˆ13
with app folder
</h2>
<h2>
If you want to see old implementation, go to `_pages/index.js`
</h2>
<Link href="/about">
About page
</Link>
<h2>If you want to see old implementation, go to `_pages/index.js`</h2>
<Link href="/about">About page</Link>
</>
);
)
}

0 comments on commit bd87c3a

Please sign in to comment.