Skip to content

Commit

Permalink
Merge branch 'main' into main-feature/135-create-studysession-page
Browse files Browse the repository at this point in the history
  • Loading branch information
mariodev9 authored Sep 12, 2022
2 parents 630ffb4 + 048fe3a commit d00fd65
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 40 deletions.
8 changes: 0 additions & 8 deletions modules/Auth/components/LogoutButton.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions modules/Auth/firebase/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "firebase/auth";

import { auth } from "@/firebaseConfig";
Expand All @@ -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;
}
Expand All @@ -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);
}
Expand Down
41 changes: 36 additions & 5 deletions modules/shared/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,9 +20,10 @@ import MenuLogo from "../Icons/MenuLogo";

const Links = [
{ title: "Colecciones", href: "/" },
{ title: "Sesión de estudio", href: "/SesiónEstudio" },
{ title: "Sesión de estudio", href: "/study-sessions" },
{ title: "Tienda", href: "/Tienda" },
{ title: "Perfil", href: "/Perfil" },
{ title: "Cerrar sesión", onClick: logOut },
];

const Menu = () => {
Expand All @@ -32,11 +35,26 @@ const Menu = () => {
<Box>
<MenuLogo fill="white" width={18} height={23} borderColor="primary.100" borderWidth={7} />
</Box>
<Box onClick={onOpen} cursor="pointer">
<Box onClick={onOpen} cursor="pointer" display={{ lg: "none" }}>
<Hamburguer />
</Box>
<Box display={{ base: "none", lg: "flex" }}>
{Links.map((link) => {
if (link.onClick) {
return (
<Button onClick={link.onClick} variant="link">
<Text variant="navbar">{link.title}</Text>
</Button>
);
}
return (
<Text key={link.href} variant="navbar">
<Link href={link.href}>{link.title}</Link>
</Text>
);
})}
</Box>
</Flex>

<Drawer onClose={onClose} isOpen={isOpen} size={{ base: "full", md: "sm" }}>
<DrawerOverlay />
<DrawerContent bg="primary.100">
Expand All @@ -50,9 +68,22 @@ const Menu = () => {
borderWidth={2}
/>
{Links.map((link) => {
if (link.onClick) {
return (
<Button
position="fixed"
bottom="5vh"
left="2vh"
onClick={link.onClick}
variant="link"
>
<Text variant="drawer">{link.title}</Text>
</Button>
);
}
return (
<Text variant="menu" key={link.href}>
<Link href={link.href}>{link.title}</Link>
<Text key={link.href} variant="drawer">
<Link href={link.href || ""}>{link.title}</Link>
</Text>
);
})}
Expand Down
45 changes: 29 additions & 16 deletions modules/shared/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ const colors: CustomColors = {
};

const components: Theme["components"] = {
Text: {
variants: {
menu: {
textAlign: "center",
color: "white",
fontWeight: 500,
fontSize: "1.5rem",
marginTop: "45px",
},
label: {
color: "label.50",
fontWeight: 600,
fontSize: "18px",
},
},
},
Button: {
baseStyle: {
height: "auto",
Expand Down Expand Up @@ -102,6 +86,35 @@ const components: Theme["components"] = {
},
},

Text: {
variants: {
label: {
color: "label.50",
fontWeight: 600,
fontSize: "18px",
},
drawer: {
textAlign: "center",
color: "white",
fontWeight: 500,
fontSize: "20px",
marginTop: "45px",
},
navbar: {
textAlign: "center",
color: "gray.300",
fontWeight: 400,
fontSize: "19px",
borderBottom: "3px solid white",
ml: "60px",
_hover: {
color: "primary.100",
borderBottom: "3px solid",
},
},
},
},

Textarea: {
// style object for base or default style
baseStyle: {
Expand Down
1 change: 0 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const Home: NextPage & { requiresAuthentication: boolean } = () => {
<meta name="description" content="Flashcards study app" />
<link rel="icon" href="/favicon.ico" />
</Head>

<div>
<Menu />
<MyCollectionsPage />
Expand Down
19 changes: 12 additions & 7 deletions pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,23 @@ const LoginPage: NextPage & { redirectIfAuthenticated: boolean } = () => {
onChange={handleChange}
errorMsg={errorMsg}
/>

<Link href="/forget-password">
<Button variant="link" colorScheme="blue" size="sm">
<Button
justifyContent="flex-start"
marginTop={0}
variant="link"
colorScheme="blue"
size="sm"
>
¿Olvidastes tu contraseña?
</Button>
</Link>
<Link href="/register">
<Button variant="link" colorScheme="blue" size="sm">
¿Eres Nuevo, Crea tu Cuenta?
</Button>
</Link>
</Form>
<Link href="/register">
<Button variant="link" colorScheme="blue" size="sm">
Crea tu Cuenta
</Button>
</Link>
</AuthFormLayout>
);
};
Expand Down
3 changes: 2 additions & 1 deletion pages/study-sessions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Center, Container, Grid, GridItem, Select, Text } from "@chakra-ui/reac
const StudySessions: NextPage = () => {
const router = useRouter();
const handleDelete = (id: string) => {
// Delete Funciont Id
console.log(id);
};

Expand Down Expand Up @@ -55,6 +54,7 @@ const StudySessions: NextPage = () => {
display="flex"
justifyContent="center"
>

<Center
flexDirection={{ mobile: "row", desktop: "column" }}
border={{ base: "0", desktop: "2px" }}
Expand All @@ -67,6 +67,7 @@ const StudySessions: NextPage = () => {
Crear nueva sesión
</Text>
</Center>

</GridItem>
{/* ------------MAP con las respectivas props-----------------*/}
<GridItem w="100%">
Expand Down

0 comments on commit d00fd65

Please sign in to comment.