I'm working on a checkout page for training, I'm new to css and react. I would like my text to be displayed inline like in the picture1 enter image description herebut I got so far is this picture2enter image description here I tried to change the position, then top and left, I tried also flex:'right' on the Total text, but I don't think it's the right approach. Can some help or give a hint?
import React, { Component } from 'react';
import './Order.css';
class Order extends Component {
constructor(props) {
super(props)
this.state = {
price: 0,
name: "",
quantity: 0,
image: "",
itemList: [
{image:('Images/prod-TN-1.jpg'), price: 949.00, name: '17ft x 12ft Jumpking Deluxe Rectangular Trampoline with Enclosure', quantity: 1 },
{image:('Images/prod-TN-2.jpg'), price: 369.00, name: '14ft Salta Black Round Confort Edition Trampoline with Enclosure', quantity: 1 }
]}
}
total() {
return this.state.itemList
.reduce((a, b) => a + b.price, 0);
}
render() {
return (
<div>
<h2 className="order-header">Here's What You've Ordered</h2>
<div >
<div>
{this.state.itemList.map((item, index) => (
<div className="order-text" style={{clear:"left"}}key={index}>
<p style={{float:'left'}}> <img className="prod" src={item.image} alt=""/></p>
<p className="name"> {item.name}</p>
<p>£{item.price}</p>
<p>QTY{item.quantity}</p>
</div>
)
)}
</div>
<div className="line-bottom"></div>
<div className="total">
<h3>Subtotal <span>£{this.total()}</span></h3>
<span>Delivery</span>
<span>Next Working Day (if ordered before 3pm)</span>
<h3>Free</h3>
<h3>Total <span>£{this.total()}</span></h3>
<div className="payment">
<p>You paid using Mastercard</p>
<img className="card-icon" src="Images/card-icon.svg" alt="card" />
</div>
</div>
</div>
</div>
);
}
}
export default Order;
.order-text {
font-weight: bolder;
/* border-top: lightgray 1px solid; */
margin-left: 20px;
font-size: 12px;
}
.name {
margin-top: 40px;
font-size: 12px;
}
.order-header {
margin-left: 20px;
}
.line-bottom {
border-top: lightgray 1px solid;
margin-top: 80px;
}
.prod {
height: 100px;
width: 100px;
}
.total {
font-size: 12px
}
.card-icon {
height: 40px;
width: 40px;
position: absolute;
left: 11%;
top: 99%;
}