Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pokedex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mthomas41
pokedex
Commits
cb15d2c2
Commit
cb15d2c2
authored
Jan 5, 2022
by
mthomas41
Browse files
Options
Downloads
Patches
Plain Diff
pokemoning typing will now display specific colors
parent
e9d3098b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
my-pokedex/src/App.js
+1
-1
1 addition, 1 deletion
my-pokedex/src/App.js
my-pokedex/src/features/dex.js
+40
-21
40 additions, 21 deletions
my-pokedex/src/features/dex.js
my-pokedex/src/features/dexstyle.css
+4
-0
4 additions, 0 deletions
my-pokedex/src/features/dexstyle.css
with
45 additions
and
22 deletions
my-pokedex/src/App.js
+
1
−
1
View file @
cb15d2c2
import
{
Dex
}
from
'
./features/dex
'
;
import
Dex
from
'
./features/dex
'
;
import
'
./App.css
'
;
function
App
()
{
...
...
This diff is collapsed.
Click to expand it.
my-pokedex/src/features/dex.js
+
40
−
21
View file @
cb15d2c2
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
styles
from
'
./dexstyle.css
'
;
import
Card
from
'
react-bootstrap/Card
'
import
ProgressBar
from
'
react-bootstrap/ProgressBar
'
...
...
@@ -13,25 +14,42 @@ function Pokemon(name, typing, moves, abilities, stats, artwork) {
this
.
artwork
=
artwork
;
}
function
PokemonCard
(
props
)
{
return
(
<>
<
label
>
{
props
.
name
}
<
/label
>
<
button
>
info
<
/button
>
<
/
>
);
}
export
function
Dex
()
{
export
default
function
Dex
()
{
const
[
listofpokemon
,
setlistofpokemon
]
=
useState
([]);
const
[
disable
,
setDisable
]
=
useState
(
false
);
const
colors
=
{
normal
:
'
cornsilk
'
,
grass
:
'
green
'
,
fire
:
'
red
'
,
water
:
'
blue
'
,
electric
:
'
yellow
'
,
ice
:
'
darkturquoise
'
,
fighting
:
'
firebrick
'
,
poison
:
'
darkmagenta
'
,
ground
:
'
tan
'
,
rock
:
'
sienna
'
,
flying
:
'
silver
'
,
steel
:
'
slategrey
'
,
psychic
:
'
deeppink
'
,
bug
:
'
yellowgreen
'
,
ghost
:
'
darkslateblue
'
,
dark
:
'
darkslategrey
'
,
dragon
:
'
royalblue
'
,
fairy
:
'
thistle
'
}
function
getTyping
(
types
){
if
(
types
.
length
===
1
)
{
return
colors
[
types
[
0
].
type
.
name
];
}
else
{
return
'
linear-gradient(to left,
'
+
types
.
map
(
type
=>
colors
[
type
.
type
.
name
]).
join
()
+
'
)
'
;
}
}
// useEffect ( () => {
// pokemonFetcher();
...
...
@@ -64,18 +82,19 @@ export function Dex() {
<
ul
>
{
listofpokemon
.
length
>
0
?
listofpokemon
.
map
((
pokemon
)
=>
(
<>
<
li
key
=
{
pokemon
.
id
}
>
<
Card
style
=
{{
width
:
'
18rem
'
}}
>
<
Card
.
Header
>
{
pokemon
.
name
}
<
/Card.Header
>
<
Card
.
Img
variant
=
"
top
"
src
=
{
pokemon
.
sprites
.
front_default
}
/
>
<
Card
.
Body
>
<
Card
.
Title
>
{
pokemon
.
name
}
<
/Card.Title
>
<
Card
.
Text
>
<
Card
.
Title
style
=
{{
background
:
getTyping
(
pokemon
.
types
)}}
>
{
pokemon
.
types
.
length
>
1
?
`
${
pokemon
.
types
[
0
].
type
.
name
}
,
${
pokemon
.
types
[
1
].
type
.
name
}
`
`
${
pokemon
.
types
[
0
].
type
.
name
}
${
pokemon
.
types
[
1
].
type
.
name
}
`
:
`
${
pokemon
.
types
[
0
].
type
.
name
}
`
}
<
br
/>
<
/Card.Title
>
<
Card
.
Text
>
{
`health points:`
}
<
ProgressBar
now
=
{
pokemon
.
stats
[
0
].
base_stat
}
max
=
{
200
}
label
=
{
`
${
pokemon
.
stats
[
0
].
base_stat
}
`
}
/> <br/
>
{
`attack:`
}
...
...
@@ -95,7 +114,7 @@ export function Dex() {
<
/Card
>
<
/
>
<
/
li
>
))
:
null
}
...
...
This diff is collapsed.
Click to expand it.
my-pokedex/src/features/dexstyle.css
0 → 100644
+
4
−
0
View file @
cb15d2c2
.cardtitle
{
background
:
linear-gradient
(
to
left
,
cornsilk
50%
,
#0000ff
50%
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment