Skip to content

Commit

Permalink
se fija el tamano de tarjeta en portrait
Browse files Browse the repository at this point in the history
  • Loading branch information
DannitaZz committed Feb 4, 2022
1 parent 17728dc commit 4eaf150
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
17 changes: 16 additions & 1 deletion src/components/pages/pokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@ const typeFilter = (type, data) => {
if(type === 'all'){
return data
}else{
return data.filter(item=>(item.pokemon_v2_pokemontypes[0].pokemon_v2_type.name === type))
return data.filter(item=>{
let type_1
let type_2
if (item.pokemon_v2_pokemontypes.length === 2) {
type_1 = item.pokemon_v2_pokemontypes[0].pokemon_v2_type.name
type_2 = item.pokemon_v2_pokemontypes[1].pokemon_v2_type.name
}else{
type_1 = item.pokemon_v2_pokemontypes[0].pokemon_v2_type.name
type_2 = item.pokemon_v2_pokemontypes[0].pokemon_v2_type.name
}
if(type_1 === type || type_2 === type){
return true
}else{
return false
}
})
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/pokelist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ function Pokelist({ favs, data, page, pageSize, dispatch }) {
</CardActions>

</Card>
<ListItem key={`pokemon_${pokemon.id}`} alignItems="center" sx={{ width: '100%', bgcolor: 'background.paper', height:'17.5vh', display: { xs: 'flex', sm: 'none' } }} >
<Card sx={{ display: 'flex', width: '93vw', height: '15vh' }} key={pokemon.id}>
<ListItem key={`pokemon_${pokemon.id}`} alignItems="center" sx={{ width: '100%', bgcolor: 'background.paper', height:'150px', display: { xs: 'flex', sm: 'none' } }} >
<Card sx={{ display: 'flex', width: '93vw', height: '140px' }} key={pokemon.id}>
<CardContent sx={{ flex: '1 1 auto', flexDirection: 'row' }}>
<Stack sx={{ display: 'flex',
flexDirection: 'row',
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const reducer = (state, action) => {
localStorage.setItem('favIds', JSON.stringify(currentFavIds));
return {...state, favs: newFavs, favIds: currentFavIds}
case 'filterName':
return {...state, filterState: {...state.filterState, name: action.value}}
return {...state, filterState: {...state.filterState, name: action.value}, mainPage: {...state.mainPage, page: 1}, favPage: {...state.favPage, page: 1}}
case 'filterType':
let newType = action.value
// console.log(newType)
Expand All @@ -85,7 +85,7 @@ export const reducer = (state, action) => {
} else {
newType = 'all'
}
return {...state, filterState: {...state.filterState, type: newType}}
return {...state, filterState: {...state.filterState, type: newType}, mainPage: {...state.mainPage, page: 1}, favPage: {...state.favPage, page: 1}}
case 'login':
//console.log('login got to the reducer')
localStorage.setItem('login', 'true')
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createTheme, ThemeProvider } from '@mui/material/styles';
import { checkValue } from './utils'

const appName = 'pokedata'
const version = '0.15'
const version = '0.16'

checkValue('appName', appName)
checkValue('version', version)
Expand Down

0 comments on commit 4eaf150

Please sign in to comment.