From 6aa98855b78645544dd69e70ac445e3a2cab81a6 Mon Sep 17 00:00:00 2001 From: Danna Cardenas Date: Wed, 2 Feb 2022 14:22:17 -0500 Subject: [PATCH] Se definen los componentes de las barras superior e inferior --- src/App.js | 4 +- src/components/bottombar.jsx | 39 ++++++++++++++++++++ src/components/filterbar.jsx | 48 ++++++++++++++++++++++++ src/components/navbar.jsx | 19 +++++++--- src/components/pages/pokemon.jsx | 2 + src/components/searchbar.jsx | 63 ++++++++++++++++++++++++++++++++ 6 files changed, 168 insertions(+), 7 deletions(-) create mode 100644 src/components/bottombar.jsx create mode 100644 src/components/filterbar.jsx create mode 100644 src/components/searchbar.jsx diff --git a/src/App.js b/src/App.js index d3e4b51..289b746 100644 --- a/src/App.js +++ b/src/App.js @@ -6,6 +6,8 @@ import { BrowserRouter, Routes, Route } from 'react-router-dom'; import Pokemon from './components/pages/pokemon'; import Details from './components/pages/details'; import Favorites from './components/pages/favorites'; +import FixedBottomNavigation from './components/bottombar'; +import SearchAppBar from './components/searchbar'; function App() { @@ -19,7 +21,7 @@ function App() { } /> } /> } /> - {/* } /> */} + } /> diff --git a/src/components/bottombar.jsx b/src/components/bottombar.jsx new file mode 100644 index 0000000..eb2ecd1 --- /dev/null +++ b/src/components/bottombar.jsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import Box from '@mui/material/Box'; +import CssBaseline from '@mui/material/CssBaseline'; +import BottomNavigation from '@mui/material/BottomNavigation'; +import BottomNavigationAction from '@mui/material/BottomNavigationAction'; +import Paper from '@mui/material/Paper'; +import CatchingPokemonIcon from '@mui/icons-material/CatchingPokemon'; +import StarIcon from '@mui/icons-material/Star'; +import ExitToAppIcon from '@mui/icons-material/ExitToApp'; +import { useNavigate } from 'react-router-dom'; + +export default function FixedBottomNavigation() { + const navigateTo = useNavigate(); + return ( + + + + { + if (newValue === '0'){ + navigateTo('/'); + } else if (newValue === '1') { + navigateTo('/favorites'); + } else if (newValue === '2') { + /* navigateTo('/login') */ + console.log(newValue); + } + }} + > + } /> + } /> + } /> + + + + ); +} + diff --git a/src/components/filterbar.jsx b/src/components/filterbar.jsx new file mode 100644 index 0000000..7f9ccbe --- /dev/null +++ b/src/components/filterbar.jsx @@ -0,0 +1,48 @@ +import * as React from 'react'; +import Button from '@mui/material/Button'; +import Menu from '@mui/material/Menu'; +import MenuItem from '@mui/material/MenuItem'; +import FilterListIcon from '@mui/icons-material/FilterList'; + +export default function BasicMenu() { + const [anchorEl, setAnchorEl] = React.useState(null); + const open = Boolean(anchorEl); + const handleClick = (event) => { + setAnchorEl(event.currentTarget); + }; + const handleClose = () => { + setAnchorEl(null); + }; + + return ( +
+ + + Generation I + Generation II + Generation III + Generation IV + Generation V + Generation VI + Generation VII + Generation VIII + +
+ ); +} \ No newline at end of file diff --git a/src/components/navbar.jsx b/src/components/navbar.jsx index 50a2af7..13c4273 100644 --- a/src/components/navbar.jsx +++ b/src/components/navbar.jsx @@ -12,6 +12,8 @@ import Tooltip from '@mui/material/Tooltip'; import MenuItem from '@mui/material/MenuItem'; import logo from '../img/pokeball.png' import LogoutIcon from '@mui/icons-material/Logout'; +import BasicMenu from './filterbar'; +import SearchAppBar from './searchbar'; import { useNavigate } from "react-router-dom"; const pages = ['Pokémon', 'Favorites']; @@ -58,7 +60,7 @@ const ResponsiveAppBar = () => { }; return ( - + logo @@ -71,7 +73,7 @@ const ResponsiveAppBar = () => { > - + {/* { ))} - - + */} + {pages.map((page, i) => ( ))} - - + + + + + + + diff --git a/src/components/pages/pokemon.jsx b/src/components/pages/pokemon.jsx index f317fcf..01175fc 100644 --- a/src/components/pages/pokemon.jsx +++ b/src/components/pages/pokemon.jsx @@ -3,6 +3,7 @@ import axios from 'axios'; import ResponsiveAppBar from "../navbar" import PaginationControlled from "../pagination" import Pokelist from "../pokelist" +import FixedBottomNavigation from '../bottombar'; function Pokemon({favs, actionName, data, page, dispatch}) { @@ -54,6 +55,7 @@ function Pokemon({favs, actionName, data, page, dispatch}) { + ) } diff --git a/src/components/searchbar.jsx b/src/components/searchbar.jsx new file mode 100644 index 0000000..c0f80e7 --- /dev/null +++ b/src/components/searchbar.jsx @@ -0,0 +1,63 @@ +import * as React from 'react'; +import { styled, alpha } from '@mui/material/styles'; +import Box from '@mui/material/Box'; +import InputBase from '@mui/material/InputBase'; +import SearchIcon from '@mui/icons-material/Search'; + +const Search = styled('div')(({ theme }) => ({ + position: 'relative', + borderRadius: theme.shape.borderRadius, + backgroundColor: alpha(theme.palette.common.white, 0.15), + '&:hover': { + backgroundColor: alpha(theme.palette.common.white, 0.25), + }, + marginLeft: 0, + width: '100%', + [theme.breakpoints.up('sm')]: { + marginLeft: theme.spacing(1), + width: 'auto', + }, +})); + +const SearchIconWrapper = styled('div')(({ theme }) => ({ + padding: theme.spacing(0, 2), + height: '100%', + position: 'absolute', + pointerEvents: 'none', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', +})); + +const StyledInputBase = styled(InputBase)(({ theme }) => ({ + color: 'inherit', + '& .MuiInputBase-input': { + padding: theme.spacing(1, 1, 1, 0), + // vertical padding + font size from searchIcon + paddingLeft: `calc(1em + ${theme.spacing(4)})`, + transition: theme.transitions.create('width'), + width: '100%', + [theme.breakpoints.up('sm')]: { + width: '12ch', + '&:focus': { + width: '20ch', + }, + }, + }, +})); + +export default function SearchAppBar() { + return ( + + + + + + + + + ); +} \ No newline at end of file