-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
393 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
quick-pokemon-type-matchup/src/components/TypeChartSelector.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { useState } from 'react'; | ||
import { css } from '@emotion/react'; | ||
|
||
import TypesMainGen1 from '../data/types_main_gen1.json'; | ||
import TypesMainGen2 from '../data/types_main_gen2_5.json'; | ||
import TypesMainLatest from '../data/types_main_latest.json'; | ||
|
||
const TYPE_OPTIONS = ['main_gen1', 'main_gen2_5', 'main_latest']; | ||
|
||
const DEFAULT_OPTION = 'main_latest'; | ||
|
||
const TYPE_DATA_MAP = { | ||
main_gen1: TypesMainGen1, | ||
main_gen2_5: TypesMainGen2, | ||
main_latest: TypesMainLatest, | ||
}; | ||
|
||
const TYPE_OPTION_LABEL_MAP = { | ||
main_gen1: 'Gen 1', | ||
main_gen2_5: 'Gen 2 - 5', | ||
main_latest: 'Gen 6+', | ||
}; | ||
|
||
const TypeChartSelector = ({ setTypesCallback, className }) => { | ||
const [selectedOption, setSelectedOption] = useState(DEFAULT_OPTION); | ||
|
||
const updateOption = (newOption) => { | ||
setSelectedOption(newOption); | ||
setTypesCallback(TYPE_DATA_MAP[newOption]); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={className} | ||
css={css` | ||
color: white; | ||
display: flex; | ||
flex-wrap: wrap; | ||
column-gap: 0.5rem; | ||
row-gap: 0.2rem; | ||
align-items: center; | ||
`} | ||
> | ||
<p | ||
css={css` | ||
margin: 0; | ||
`} | ||
> | ||
Type set: | ||
</p> | ||
<select | ||
css={css` | ||
flex-grow: 1; | ||
min-width: 0; | ||
`} | ||
value={selectedOption} | ||
onChange={(e) => updateOption(e.target.value)} | ||
> | ||
{TYPE_OPTIONS.map((typeOption) => ( | ||
<option key={typeOption} value={typeOption}> | ||
{TYPE_OPTION_LABEL_MAP[typeOption]} | ||
</option> | ||
))} | ||
</select> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TypeChartSelector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
quick-pokemon-type-matchup/src/components/YourTypeReadout.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
quick-pokemon-type-matchup/src/data/types_main_gen1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
[ | ||
{ | ||
"name": "normal", | ||
"color": "#A0A0A0", | ||
"superEffective": [], | ||
"notVeryEffective": ["rock"], | ||
"noEffect": ["ghost"] | ||
}, | ||
{ | ||
"name": "fire", | ||
"color": "#FFAA66", | ||
"superEffective": ["grass", "ice", "bug"], | ||
"notVeryEffective": ["fire", "water", "rock", "dragon"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "water", | ||
"color": "#66AAFF", | ||
"superEffective": ["fire", "ground", "rock"], | ||
"notVeryEffective": ["water", "grass", "dragon"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "electric", | ||
"color": "#FFDC60", | ||
"superEffective": ["water", "flying"], | ||
"notVeryEffective": ["electric", "grass", "dragon"], | ||
"noEffect": ["ground"] | ||
}, | ||
{ | ||
"name": "grass", | ||
"color": "#6AD854", | ||
"superEffective": ["water", "ground", "rock"], | ||
"notVeryEffective": ["fire", "grass", "poison", "flying", "bug", "dragon"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "ice", | ||
"color": "#B6EAE4", | ||
"superEffective": ["grass", "ground", "flying", "dragon"], | ||
"notVeryEffective": ["water", "ice"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "fighting", | ||
"color": "#E85564", | ||
"superEffective": ["normal", "ice", "rock"], | ||
"notVeryEffective": ["poison", "flying", "psychic", "bug"], | ||
"noEffect": ["ghost"] | ||
}, | ||
{ | ||
"name": "poison", | ||
"color": "#BC74B1", | ||
"superEffective": ["grass", "bug"], | ||
"notVeryEffective": ["poison", "ground", "rock", "ghost"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "ground", | ||
"color": "#BA7A5D", | ||
"superEffective": ["fire", "electric", "poison", "rock"], | ||
"notVeryEffective": ["grass", "bug"], | ||
"noEffect": ["flying"] | ||
}, | ||
{ | ||
"name": "flying", | ||
"color": "#AABFE2", | ||
"superEffective": ["grass", "fighting", "bug"], | ||
"notVeryEffective": ["electric", "rock"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "psychic", | ||
"color": "#E07277", | ||
"superEffective": ["fighting", "poison"], | ||
"notVeryEffective": ["psychic"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "bug", | ||
"color": "#ADDD82", | ||
"superEffective": ["grass", "psychic", "poison"], | ||
"notVeryEffective": ["fire", "fighting", "flying", "ghost"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "rock", | ||
"color": "#DBD0B3", | ||
"superEffective": ["fire", "ice", "flying", "bug"], | ||
"notVeryEffective": ["fighting", "ground"], | ||
"noEffect": [] | ||
}, | ||
{ | ||
"name": "ghost", | ||
"color": "#7488BC", | ||
"superEffective": ["ghost"], | ||
"notVeryEffective": [], | ||
"noEffect": ["normal", "psychic"] | ||
}, | ||
{ | ||
"name": "dragon", | ||
"color": "#3276B5", | ||
"superEffective": ["dragon"], | ||
"notVeryEffective": [], | ||
"noEffect": [] | ||
} | ||
] |
Oops, something went wrong.