diff --git a/components/AccountMenu.tsx b/components/AccountMenu.tsx new file mode 100644 index 0000000..a59a48d --- /dev/null +++ b/components/AccountMenu.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import { signOut } from 'next-auth/react' + +const AccountMenu = () => { + return ( +
AccountMenu
+ ) +} + +export default AccountMenu \ No newline at end of file diff --git a/components/MobileMenu.tsx b/components/MobileMenu.tsx new file mode 100644 index 0000000..ef8d7ec --- /dev/null +++ b/components/MobileMenu.tsx @@ -0,0 +1,37 @@ +import React from 'react' + +interface MobileMenuProps { + visible?: boolean; +} + +const MobileMenu: React.FC = ({visible}) => { + if(!visible){ + return null; + } + return ( +
+
+
+ Home +
+
+ Serie TV +
+
+ Film +
+
+ Nuovi e Popolari +
+
+ La mia Lista +
+
+ Sfoglia per lingua +
+
+
+ ) +} + +export default MobileMenu \ No newline at end of file diff --git a/components/Navbar.tsx b/components/Navbar.tsx new file mode 100644 index 0000000..9d5b41d --- /dev/null +++ b/components/Navbar.tsx @@ -0,0 +1,49 @@ +import MobileMenu from "./MobileMenu" +import NavbarItem from "./NavbarItem" +import { BsChevronDown,BsSearch,BsBell } from "react-icons/bs" +import { useCallback,useState } from "react" +import AccountMenu from "./AccountMenu"; + +function Navbar() { + const [showMobileMenu,setShowMobileMenu] = useState(false); + const toggleMobileMenu = useCallback(()=>{ + setShowMobileMenu((currentvisible) => !currentvisible) + },[]) + return ( + + ) +} + +export default Navbar \ No newline at end of file diff --git a/components/NavbarItem.tsx b/components/NavbarItem.tsx new file mode 100644 index 0000000..7296809 --- /dev/null +++ b/components/NavbarItem.tsx @@ -0,0 +1,14 @@ +import React from "react"; +interface NavbarItemProps { + label: String; +} + +const NavbarItem: React.FC = ({label}) => { + return ( +
+ {label} +
+ ) +} + +export default NavbarItem \ No newline at end of file diff --git a/pages/auth.tsx b/pages/auth.tsx index aa02bc1..fe7ea89 100644 --- a/pages/auth.tsx +++ b/pages/auth.tsx @@ -19,7 +19,6 @@ const Auth = () => { await signIn('credentials', { email, password, - redirect: false, callbackUrl: '/profiles' }); } catch (err) { @@ -79,13 +78,13 @@ const Auth = () => { {variant === 'login' ? 'Login' : 'Crea Account'}
signIn('google', { - callbackUrl: '/' + callbackUrl: '/profiles' })} className="flex flex-row items-center gap-4 mt-8 justify-center">
signIn('github', { - callbackUrl: '/' + callbackUrl: '/profiles' })} className="w-10 h-10 bg-white rounded-full flex items-center justify-center cursor-pointer hover:opacity-80 transition">
diff --git a/pages/index.tsx b/pages/index.tsx index 6142f8f..1d55463 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,3 +1,4 @@ +import Navbar from "@/components/Navbar" import useCurrentUser from "@/hooks/useCurrentUser" import { NextPageContext } from "next" import { signOut,getSession } from "next-auth/react" @@ -19,11 +20,9 @@ export async function getServerSideProps(context: NextPageContext){ export default function Home() { - const { data: user } = useCurrentUser(); return ( <> -

Netflix Clone

- + ) } diff --git a/pages/profiles.tsx b/pages/profiles.tsx index e73f496..600f031 100644 --- a/pages/profiles.tsx +++ b/pages/profiles.tsx @@ -1,5 +1,7 @@ +import useCurrentUser from "@/hooks/useCurrentUser"; import { NextPageContext } from "next" import { getSession } from "next-auth/react" +import { useRouter } from "next/router"; export async function getServerSideProps(context: NextPageContext){ const session = await getSession(context); @@ -18,8 +20,27 @@ export async function getServerSideProps(context: NextPageContext){ function Profiles() { + const router = useRouter(); + const { data:user } = useCurrentUser(); return ( -
Profili
+
+
+

Chi sta guardando?

+
+
router.push('/')}> +
+
+ Profilo +
+
+ {user?.name} +
+
+
+
+
+ {/* https://api.dicebear.com/6.x/fun-emoji/svg?seed= */} +
) }