Skip to content

Commit

Permalink
Added blog section to website homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
EmoruwaTolu committed Feb 19, 2024
1 parent ace83d9 commit 69c9f26
Show file tree
Hide file tree
Showing 15 changed files with 459 additions and 23 deletions.
42 changes: 35 additions & 7 deletions prem-data/src/components/HomeBlog.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
import React from "react";
import React, { useState, useEffect } from "react";
import "../styles.css"

export default function HomeBlog(){

const [posts, setPosts] = useState([]);

const fetchData = async () => {

try{
const response = await fetch(`http://localhost:3001/blog-posts`);
const data = await response.json();
setPosts(data);
}
catch(error){
console.error('Error fetching players');
}

}

useEffect(() => {
fetchData('');
}, []);

console.log(posts[0])

if(posts.length === 0){
return <div>Loading data ...</div>
}

return (
<div className="blog-carousel">
<div src="" alt="news img" className="carousel-image"></div>
<div class="carousel-navigator">
<button class="carousel-locator current-image"></button>
<button class="carousel-locator"></button>
<button class="carousel-locator"></button>
<button class="carousel-locator"></button>
<div className="blog-carousel-title">Blogs</div>
<img src={posts[0].image} alt="news img" className="carousel-image"></img>
<div className="story-title">{posts[0].title}</div>
<div className="story-preview">{posts[0].preview}</div>
<div className="carousel-navigator">
<button className="carousel-locator current-image"></button>
<button className="carousel-locator"></button>
<button className="carousel-locator"></button>
<button className="carousel-locator"></button>
</div>
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions prem-data/src/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Nunito','Segoe UI', 'Roboto', 'Oxygen',
font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Nunito','Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
Expand All @@ -15,7 +15,7 @@ body {
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
font-family: 'Playfair Display', source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

Expand Down
12 changes: 12 additions & 0 deletions prem-data/src/pages/player-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ function PlayerPage() {
return <p>Loading player data...</p>;
}

const convertBase64ToBlob = (base64) => {
const byteString = atob(base64.split(',')[1]);
const mimeString = base64.split(',')[0].split(':')[1].split(';')[0];
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
const blob = new Blob([ab], { type: mimeString });
return blob;
};

return(
<div className="player-page">
<div className="player-page-container">
Expand Down
20 changes: 16 additions & 4 deletions prem-data/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,27 @@
height: 100%;
display: flex;
flex-direction: column;
color: whitesmoke;
justify-content: space-between;
border-top: solid 1px white;
}
.blog-carousel-title{
font-size: 1.5em;
border-bottom: solid 1px white;
height: 8%;
display: flex;
align-items: center;margin-bottom: 3.2em;
}
.story-title{
font-size: 1.2em;
}
.story-preview{
font-size: 0.9em;
}
.carousel-image{
width: 100%;
height: 50%;
background-color: green;
object-fit: cover;
}
.carousel-navigator{
height: fit-content;
Expand Down Expand Up @@ -169,9 +184,6 @@
overflow: hidden;
height: 300px;
}



.autosuggest-results ul {
list-style: none;
padding: 0;
Expand Down
33 changes: 33 additions & 0 deletions pythonCode/Arsenal-Stats.txt

Large diffs are not rendered by default.

32 changes: 31 additions & 1 deletion pythonCode/Chelsea-Stats.txt

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions pythonCode/Manchester-United-Stats.txt

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions pythonCode/Tottenham-Hotspur-Stats.txt

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions pythonCode/West-Ham-United-Stats.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pythonCode/playerDataMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def playerStandardStatsMaker(url, file):
##------- PROVIDE THE `teamRosterCreator` METHOD WITH A LINK TO THE PARTICULAR PREMIER LEAGUE TEAM
##------- This will print the information from the SPECIFIED team's players for that season

link = "https://fbref.com/en/squads/cff3d9bb/2021-2022/Chelsea-Stats"
link = "https://fbref.com/en/squads/7c21e445/2021-2022/West-Ham-United-Stats"
namingInfo = link.split("/")
file1 = open(namingInfo[-1]+".txt", "w")
teamInfo = teamRosterCreator(link)
Expand Down
Loading

0 comments on commit 69c9f26

Please sign in to comment.