Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "blog",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.15",
"@fortawesome/free-solid-svg-icons": "^5.7.2",
"@fortawesome/react-fontawesome": "^0.1.4",
"i": "^0.3.6",
"npm": "^6.8.0",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Binary file added public/favicon.ico
Binary file not shown.
41 changes: 41 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Blog Mika</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
9 changes: 9 additions & 0 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
19 changes: 19 additions & 0 deletions src/composant/Footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import '../css/Home.css'

//composant pied de page
function Footer(){
return (
<footer className="blogFooter">
<address className="adrFooter">
Michaël Cheloudtchenko<br />
Quartier Peña Elhortzeta<br />
64240 Hasparren<br />
06 75 40 99 00
</address>
<p className="infoBlog">Blog de test sur plateforme React. Partie front fonctionnelle, partie back et formulaires non fonctionnels pour le moment</p>
</footer>
);
}

export default Footer
64 changes: 64 additions & 0 deletions src/composant/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react'
import '../css/Home.css'
//importaion du composant de bouton pour le menu burger
import MenuButton from './MenuButton'
//importation du logo et du jeu d'icones
import logo from '../images/Metallica-M.jpg'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

//tableau pour afficher le menu
const monMenu = [
{
ancre: "Accueil",
url: "/",
title: "Retour à l'accueil"
},
{
ancre: "Contact",
url: "/contact",
title:"Contactez-moi"

},
{
ancre: "Admin",
url: "/admin",
title: "Connexion administrateur"
}
]

//composant d'entête de page avec comme paramètre l'identifiant de page qui correspond à l'index du tableau de menu
function Header({idPage}){
return (
<header className="blogHeader">
<a
className="lienLogo"
href="/"
title="Retour à l'accueil"
>
<img src={logo} className="logo" width="800" height="800" alt="Logo" />
</a>
{/* composant MenuButton qui affiche le menu burger quand l'écran est inférieur à 850px de large */}
<MenuButton />
<nav className="navMenu">
{/* boucle sur le tableau de menu, si l'identifiant de page correspond à l'index du tableau du menu on affiche la classe active en plus pour indiquer la page active */}
{monMenu.map((lien, index) => (
<a
href={lien.url}
className={idPage===index ? "lienMenu actif" : "lienMenu"}
key={index}
title={lien.title}
>
{lien.ancre}
</a>
))}
{/*formulaire de recherche non actif pour le moment*/}
<form method="post" action="search" className="formSearch">
<input type="search" name="search" className="champSearch" placeholder="Recherche..." />
<button action="submit" className="boutonFormSearch"><FontAwesomeIcon icon="search" /></button>
</form>
</nav>
</header>
);
}

export default Header
29 changes: 29 additions & 0 deletions src/composant/ListeArticle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'
import '../css/Home.css'
//importation du jeu d'icones
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

//composant pour afficher la liste des articles avec comme paramètres un tableau de données
function ListeArticle({entries}) {
return (
<ul className="listeArticle">
{/* boucle sur le tableau de données pour afficher les articles */}
{entries.map(({id, title, url, img, accroche, date, nbCommentaires}) => (
<li className="liArticle" key={id}>
<figure className="figListeArticle">
<a href={url} title="Lire la suite"><img src={img} alt={title} className="imgListeArticle" /></a>
</figure>
<h1>{title}</h1>
<p>{accroche}</p>
<a href={url} title="Lire la suite" className="lienListeArticle">Lire la suite</a>
<footer className="footerListeArticles">
<time className="pubTimeListeArticle">{date}</time>
<span className="nbComListeArticle"><FontAwesomeIcon icon="comment" /> {nbCommentaires}</span>
</footer>
</li>
))}
</ul>
);
}

export default ListeArticle
29 changes: 29 additions & 0 deletions src/composant/MenuButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, {Component} from 'react';
import '../css/Home.css';
//importation des icones
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

class MenuButton extends Component {

//j'utilise l'état local pour afficher ou effacer le menu dans le cas où l'écran est petit (<850px)
state = {
open : false
}

//fonction appelée au click sur le bouton, on change l'état local et on le met à jour
toggleMenu(e){
const newButtonState = !this.state.open
this.setState({open:newButtonState})
}

render() {
const open = this.state.open
return (
<button className={`menuBurger ${open && "ouvert"}`} onClick={() => this.toggleMenu()}>
<FontAwesomeIcon icon="bars" />
</button>
);
}
}

export default MenuButton;
Loading