Skip to content

Commit fb59108

Browse files
authored
Merge pull request #3 from linuxunil/layout
Layout
2 parents 47866aa + 15707e1 commit fb59108

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

Diff for: src/App.jsx

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState } from "react";
22
import GameCard from "./components/GameCard";
33
import "./App.css";
4-
import { Navbar, Nav, NavDropdown, Row, Col, Container } from "react-bootstrap";
4+
import { Navbar, Nav, NavDropdown, Row, Col, Container, CardGroup } from "react-bootstrap";
55

66
const defaultPokedex = [
77
{
@@ -70,7 +70,7 @@ const defaultPokedex = [
7070
function App() {
7171
const [score, setScore] = useState(0);
7272
const [highScore, setHighScore] = useState(0);
73-
const [pokedex, setPokedex] = useState(defaultPokedex);
73+
const [pokedex,] = useState(defaultPokedex);
7474
const [selectedTokens, setSelected] = useState([]);
7575
const [pokemonToDisplay, setPokemonToDisply] = useState(defaultPokedex);
7676

@@ -126,8 +126,9 @@ function App() {
126126

127127
return (
128128
<>
129-
<Navbar expand="lg" className="bg-body-tertiary" pb={4}>
130-
<Container>
129+
<Container fluid>
130+
<Navbar expand="lg" className="bg-body-tertiary" pb={4} fixed="top">
131+
131132
<Navbar.Brand href="#home">Pokemon Memorization</Navbar.Brand>
132133
<Navbar.Toggle aria-controls="basic-navbar-nav" />
133134
<Navbar.Collapse id="basic-navbar-nav">
@@ -146,12 +147,21 @@ function App() {
146147
</Row>
147148
</Col>
148149
</Navbar.Collapse>
149-
</Container>
150150

151-
</Navbar>
152-
<Container>
153-
<Row className="justify-content-md-center pt-5">
154-
{pokemonToDisplay.map((pokemon, index) => (
151+
152+
</Navbar >
153+
</Container>
154+
<Container fluid>
155+
{/* TODO add two rows. */}
156+
<Row>
157+
{pokemonToDisplay.slice(0, (pokemonToDisplay.length / 2) - 1).map((pokemon, index) => (
158+
<GameCard
159+
key={index}
160+
pokemon={pokemon}
161+
handleClick={handleClick}
162+
/>
163+
))}
164+
{pokemonToDisplay.slice((pokemonToDisplay.length / 2), pokemonToDisplay.length - 1).map((pokemon, index) => (
155165
<GameCard
156166
key={index}
157167
pokemon={pokemon}

Diff for: src/components/GameCard.jsx

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, useState } from "react";
2-
import { Card, Col, Placeholder } from "react-bootstrap";
2+
import { Image, Col, Placeholder } from "react-bootstrap";
33
import axios from "../axios";
44

55
//Display picture of pokemon
@@ -32,17 +32,19 @@ export default function GameCard(props) {
3232
}, [imageURL, props.pokemon.name]);
3333

3434
return (
35-
<Col md={"auto"}>
36-
<Card style={{ width: "14rem", height: "15rem" }}
37-
onClick={() => {
38-
props.handleClick(name);
39-
}}
40-
>
41-
<Card.Img variant="top" src={imageURL} />
42-
<Card.Body>
43-
<Card.Title>{name}</Card.Title>
44-
</Card.Body>
45-
</Card>
35+
<Col xs={4} md={3}>
36+
<Image src={imageURL} fluid onClick={() => { props.handleClick(name) }} />
37+
<p>{name}</p>
4638
</Col>
39+
// <Col key={props.index}>
40+
// <Card onClick={() => { props.handleClick(name); }} style={{
41+
// fontSize: "5vw"
42+
// }}>
43+
// <Card.Img variant="top" src={imageURL} />
44+
// <Card.Body>
45+
// <Card.Text>{name}</Card.Text>
46+
// </Card.Body >
47+
// </Card >
48+
// </Col>
4749
);
4850
}

0 commit comments

Comments
 (0)