This commit is contained in:
Martin Quarda 2024-10-14 07:40:41 +02:00
parent 2cf3ecfe61
commit 9a65214c01

View File

@ -250,6 +250,11 @@ class Main extends Component {
<a class="nav-link" href="#eshop">Eshop</a> <a class="nav-link" href="#eshop">Eshop</a>
</li> </li>
} }
{this.state.cart.length > 0 &&
<li class="nav-item">
<a class="nav-link" href="#cart">Košík</a>
</li>
}
</ul> </ul>
</div> </div>
</nav> </nav>
@ -261,6 +266,27 @@ class Main extends Component {
<div class="absolute container-fluid alert alert-danger" onClick={(e) => {this.setState({status: "", status_text:""})}}> <div class="absolute container-fluid alert alert-danger" onClick={(e) => {this.setState({status: "", status_text:""})}}>
{this.state.status_text} {this.state.status_text}
</div>} </div>}
{this.state.page == "#cart" &&
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">Název</th>
<th scope="col">Množství</th>
<th scope="col">Cena</th>
</tr>
</thead>
<tbody>
{this.state.cart.map(product =>
<tr>
<td>{product.name}</td>
<td>{product.quantity}</td>
<td>{product.price} </td>
</tr>)}
</tbody>
</table>
</div>}
{this.state.page == "#eshop" && {this.state.page == "#eshop" &&
<div class="container"> <div class="container">
{this.state.products.map(product => {this.state.products.map(product =>
@ -300,7 +326,6 @@ class Main extends Component {
<td>{racer.paid?"Zaplatil":"Nezaplatil"}</td> <td>{racer.paid?"Zaplatil":"Nezaplatil"}</td>
<td><button type="button" class="btn btn-light" onClick={(e) => {this.editRacer(racer)}}>Změnit</button></td> <td><button type="button" class="btn btn-light" onClick={(e) => {this.editRacer(racer)}}>Změnit</button></td>
</tr>)} </tr>)}
</tbody> </tbody>
</table> </table>
</div> </div>