From c23a8c50f5edc082a9bfb1f90ed175cf3b9e3d87 Mon Sep 17 00:00:00 2001 From: Anibal Olivares Date: Sun, 11 Sep 2022 13:56:07 -0400 Subject: [PATCH 1/3] Fix login design --- pages/login.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pages/login.tsx b/pages/login.tsx index 4d1ba8a..69cc562 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -73,18 +73,22 @@ const LoginPage: NextPage & { redirectIfAuthenticated: boolean } = () => { onChange={handleChange} errorMsg={errorMsg} /> - - - - - + + + ); }; From e5c224dc22c01cfaf7d4e1b1b51562b225dd2c03 Mon Sep 17 00:00:00 2001 From: Anibal Olivares Date: Sun, 11 Sep 2022 14:14:10 -0400 Subject: [PATCH 2/3] Fix Logout Button design --- modules/Auth/components/LogoutButton.tsx | 8 ---- modules/Auth/firebase/auth.ts | 4 +- modules/shared/components/Menu/Menu.tsx | 54 ++++++++++++++++++------ pages/index.tsx | 2 - 4 files changed, 42 insertions(+), 26 deletions(-) delete mode 100644 modules/Auth/components/LogoutButton.tsx diff --git a/modules/Auth/components/LogoutButton.tsx b/modules/Auth/components/LogoutButton.tsx deleted file mode 100644 index 2317f8e..0000000 --- a/modules/Auth/components/LogoutButton.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import { logOut } from "@/modules/Auth/firebase/auth"; - -const LogoutButton: React.FC = () => { - return ; -}; - -export default LogoutButton; diff --git a/modules/Auth/firebase/auth.ts b/modules/Auth/firebase/auth.ts index 918c0b9..11edb0b 100644 --- a/modules/Auth/firebase/auth.ts +++ b/modules/Auth/firebase/auth.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "firebase/auth"; import { auth } from "@/firebaseConfig"; @@ -18,7 +19,6 @@ export const logIn = async (email: string, password: string) => { const user = await signInWithEmailAndPassword(auth, email, password); return user; } catch (error) { - // eslint-disable-next-line no-console console.error(error); return null; } @@ -27,7 +27,7 @@ export const logIn = async (email: string, password: string) => { export const logOut = async () => { try { await signOut(auth); - return window.alert("User Logged Out"); + console.log(">>>"); } catch (error) { console.error(error); } diff --git a/modules/shared/components/Menu/Menu.tsx b/modules/shared/components/Menu/Menu.tsx index 9039814..f866ce9 100644 --- a/modules/shared/components/Menu/Menu.tsx +++ b/modules/shared/components/Menu/Menu.tsx @@ -1,8 +1,10 @@ import React from "react"; import Link from "next/link"; +import { logOut } from "@/modules/Auth/firebase/auth"; import { Box, + Button, Drawer, DrawerBody, DrawerCloseButton, @@ -21,6 +23,7 @@ const Links = [ { title: "Sesión de estudio", href: "/study-sessions" }, { title: "Tienda", href: "/Tienda" }, { title: "Perfil", href: "/Perfil" }, + { title: "Cerrar sesión", onClick: logOut }, ]; const Menu = () => { @@ -36,13 +39,20 @@ const Menu = () => { - {Links.map((link) => ( - - - {link.title} - - - ))} + {Links.map((link) => { + if (link.onClick) { + return ; + } + return ( + + + {link.title} + + + ); + })} @@ -57,13 +67,29 @@ const Menu = () => { borderColor="primary.100" borderWidth={2} /> - {Links.map((link) => ( - - - {link.title} - - - ))} + {Links.map((link) => { + if (link.onClick) { + return ( + + ); + } + return ( + + + {link.title} + + + ); + })} diff --git a/pages/index.tsx b/pages/index.tsx index 99e2c98..6e87e19 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -3,7 +3,6 @@ import Head from "next/head"; import nookies from "nookies"; import { verifyIdToken } from "@/firebaseAdminConfig"; -import LogoutButton from "@/modules/Auth/components/LogoutButton"; import MyCollectionsPage from "@/modules/Collections/MyCollectionsPage"; import Menu from "@/modules/shared/components/Menu/Menu"; @@ -17,7 +16,6 @@ const Home: NextPage & { requiresAuthentication: boolean } = () => {
-
From 641a3b6ccf091e5c1a65a3bd46db5cdaeda59a5c Mon Sep 17 00:00:00 2001 From: Anibal Olivares Date: Sun, 11 Sep 2022 14:15:46 -0400 Subject: [PATCH 3/3] Run prettier fix --- modules/shared/components/Menu/Menu.tsx | 23 ++++++++++------------- modules/shared/theme/index.ts | 3 +-- pages/login.tsx | 3 ++- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/shared/components/Menu/Menu.tsx b/modules/shared/components/Menu/Menu.tsx index f866ce9..37969cd 100644 --- a/modules/shared/components/Menu/Menu.tsx +++ b/modules/shared/components/Menu/Menu.tsx @@ -41,15 +41,15 @@ const Menu = () => { {Links.map((link) => { if (link.onClick) { - return ; + return ( + + ); } return ( - - {link.title} - + {link.title} ); })} @@ -75,18 +75,15 @@ const Menu = () => { bottom="5vh" left="2vh" onClick={link.onClick} - variant="link"> - - {link.title} - + variant="link" + > + {link.title} ); } return ( - - {link.title} - + {link.title} ); })} diff --git a/modules/shared/theme/index.ts b/modules/shared/theme/index.ts index bebd163..cfef4cd 100644 --- a/modules/shared/theme/index.ts +++ b/modules/shared/theme/index.ts @@ -39,7 +39,6 @@ const colors: CustomColors = { }; const components: Theme["components"] = { - Button: { baseStyle: { height: "auto", @@ -86,7 +85,7 @@ const components: Theme["components"] = { size: "md", }, }, - + Text: { variants: { label: { diff --git a/pages/login.tsx b/pages/login.tsx index 69cc562..e8e5367 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -79,7 +79,8 @@ const LoginPage: NextPage & { redirectIfAuthenticated: boolean } = () => { marginTop={0} variant="link" colorScheme="blue" - size="sm"> + size="sm" + > ¿Olvidastes tu contraseña?