This repository has been archived by the owner on Aug 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove unwanted css for App logo * importation des données par fichier JSON * rendu condition et affichage de 15 elements
- Loading branch information
Showing
14 changed files
with
176 additions
and
646 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import React, { useState } from 'react' | ||
|
||
const ButtonsSection = ({ menuButtons }) => { | ||
const [selectedId, setSelectedId] = useState(null); | ||
const ButtonsSection = ({ menuButtons, selectedId, onClick }) => { | ||
const handleOnClick = (buttonId) => { | ||
onClick(buttonId) | ||
} | ||
|
||
return ( | ||
<div> | ||
<ul align="left"> | ||
<> | ||
<ul> | ||
{menuButtons.map(mButton => ( | ||
<li><button type="button" | ||
key={mButton.id} | ||
className={mButton.id === selectedId ? 'selected' : ''} | ||
onClick={() => setSelectedId(mButton.id)} | ||
>{mButton.name}</button></li> | ||
<li key={mButton.id}> | ||
<button type="button" | ||
className={mButton.id === selectedId ? 'selected' : ''} | ||
onClick={() => handleOnClick(mButton.id)} | ||
>{mButton.name}</button> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
</> | ||
) | ||
} | ||
|
||
export default ButtonsSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
function FontaineTable(props) { | ||
|
||
const fontaineList = props.fontaineList | ||
const handleSort = (column) => { props.onSort(column) } | ||
|
||
const [showDetails, setShowDetails] = React.useState({ show: false, id: -1 }) | ||
|
||
return ( | ||
<> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th className='clickable left' onClick={() => handleSort('Arrondissement')}>Arrondissement</th> | ||
<th className='clickable left'>Type</th> | ||
<th className='clickable left' onClick={() => handleSort('Nom_parc_lieu')}>Nom du lieu</th> | ||
<th className='clickable left' onClick={() => handleSort('Intersection')}>Adresse</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{ | ||
fontaineList.map(fontaine => { | ||
return ( | ||
<tr key={fontaine.ID}> | ||
<td className='left'> {fontaine.Arrondissement} </td> | ||
<td className='left'> Fontaine à boire </td> | ||
<td className='left'> {fontaine.Nom_parc_lieu} </td> | ||
<td className='left'> {fontaine.Intersection} </td> | ||
<td className='center'> | ||
<button onClick={() => setShowDetails({ show: true, id: fontaine.ID })}> | ||
IC | ||
</button> | ||
</td> | ||
</tr>) | ||
}) | ||
} | ||
</tbody> | ||
</table> | ||
{showDetails.show && ( | ||
<div> | ||
{props.fontaineList.filter(fontaine => fontaine.ID === showDetails.id).map((selectedFontaine, i) => ( | ||
<div key={selectedFontaine.ID + "-" + i}> | ||
<h3>Point d'intérêt</h3> | ||
<div> | ||
<p>Proximité: {selectedFontaine.Proximité_jeux_repère}</p> | ||
<p>Remarque: {selectedFontaine.Remarque}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
FontaineTable.propTypes = { | ||
fontaineList: PropTypes.array | ||
} | ||
|
||
export default FontaineTable |
Oops, something went wrong.