wired up home page adjust image sizes

This commit is contained in:
StevanFreeborn
2022-06-25 14:23:41 -05:00
parent 0447157364
commit ac03ca3502
28 changed files with 119 additions and 8 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 537 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 890 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 543 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 KiB

After

Width:  |  Height:  |  Size: 976 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 393 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 628 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 KiB

After

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 KiB

After

Width:  |  Height:  |  Size: 898 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 KiB

After

Width:  |  Height:  |  Size: 501 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 KiB

After

Width:  |  Height:  |  Size: 743 KiB

+15
View File
@@ -0,0 +1,15 @@
import React from 'react';
import Container from 'react-bootstrap/Container';
import Row from 'react-bootstrap/Row';
export default function CardHolder(props) {
return(
<Container fluid className="bg-dark">
<Row className="d-flex flex-row justify-content-center align-items-center">
{props.children}
</Row>
</Container>
);
}
+23
View File
@@ -0,0 +1,23 @@
import React from 'react';
import Card from 'react-bootstrap/Card';
export default function CharacterCard(props) {
const characterName = props.character.fullName;
const image = new URL(props.character.image).pathname;
return(
<Card style={{ width: '22rem' }} className='p-1 m-3'>
<Card.Img variant='top' src={image} width='100%' />
<Card.Body>
<Card.Title>{characterName}</Card.Title>
<Card.Text>
Some quick example text to build on the card title and make up the
bulk of the card's content.
</Card.Text>
</Card.Body>
</Card>
);
}
+2 -4
View File
@@ -8,13 +8,11 @@ export default function Greeting() {
return (
<Container>
<Row>
<Row className='py-5'>
<Col className='text-center'>
<h1
className='pt-5'
>
<h1>
The <span className='highlight'>Criminal</span> Minds API
</h1>
+10 -1
View File
@@ -1,3 +1,12 @@
const baseUrl = process.env.NODE_ENV == 'development' ?
const baseUrl = process.env.NODE_ENV === 'development' ?
'' :
'http://criminalmindsapi.azurewebsites.net';
const versionHeader = 'x-api-version';
const versionHeaderValue = 1;
export {
baseUrl,
versionHeader,
versionHeaderValue
};
+42 -1
View File
@@ -1,11 +1,52 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import Greeting from '../components/greeting';
import CardHolder from '../components/cardHolder';
import CharacterCard from '../components/characterCard';
import CharacterService from '../services/characterService';
const characterService = new CharacterService();
export default function Home() {
const [characters, setCharacters] = useState([]);
const getCharacters = async () => {
const res = await characterService.getCharacters();
const characters = await res.json();
return setCharacters(characters);
}
useEffect(() => {
getCharacters();
}, []);
const getCharacterCards = () => {
return characters.map(character => {
return (
<CharacterCard
character={character}
/>
);
})
}
return (
<>
<Greeting/>
<CardHolder>
{getCharacterCards()}
</CardHolder>
</>
);
}
+19
View File
@@ -0,0 +1,19 @@
import { baseUrl, versionHeader, versionHeaderValue } from '../constants';
class CharacterService {
getCharacters = async () => {
const res = await fetch(`${baseUrl}/api/characters`, {
headers: {
[versionHeader]: versionHeaderValue
}
});
return res;
}
}
export default CharacterService;
+4 -1
View File
@@ -1,7 +1,10 @@
const { createProxyMiddleware } = require('http-proxy-middleware');
const context = [
'/api/seasons'
'/api/seasons',
'/api/characters',
'/api/quotes',
'/api/episodes'
];
module.exports = function (app) {
+4 -1
View File
@@ -1,7 +1,10 @@
/* Bootstrap Overrides */
.navbar-toggler {
border: none;
}
.navbar-toggler:focus,
.navbar-toggerl:active:focus {
.navbar-toggler:active:focus {
box-shadow: none;