React Basic Hooks - useEffects sample
HTML
<div id="root"></div>
CSS
body{
background-color:grey
}
.booking-movie-container {
margin: 20px 0;
}
.booking-movie-container select {
background-color: #fff;
border: 0;
border-radius: 5px;
font-size: 14px;
margin-left: 10px;
padding: 5px 15px 5px 15px;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
}
.booking-container {
perspective: 1000px;
margin-bottom: 30px;
}
.booking-seat {
background-color: #ed0c6b82; ;
height: 25px;
width: 25px;
margin: 3px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.booking-seat.booking-selected {
background-color: #fd3c3c;
}
.walking-space{
margin-right: 2%;
}
.booking-seat.booking-occupied {
background-color: #fff;
}
/* .booking-seat:nth-of-type(2) {
margin-right: 18px;
}
.booking-seat:nth-last-of-type(2) {
margin-left: 18px;
} */
.booking-seat:not(.booking-occupied):hover {
cursor: pointer;
transform: scale(1.2);
}
.booking-showcase .booking-seat:not(.booking-occupied):hover {
cursor: default;
transform: scale(1);
}
.booking-showcase {
background: rgba(0, 0, 0, 0.1);
padding: 5px 10px;
border-radius: 5px;
color: #777;
list-style-type: none;
display: flex;
justify-content: space-between;
}
.count{
background-color: linear-gradient(to right, #ee7724, #d8363a, #dd3675, #b44593) !important;
}
.booking-showcase li {
display: flex;
align-items: center;
justify-content: center;
margin: 0 10px;
}
.booking-showcase li small {
margin-left: 2px;
}
.booking-row {
display: flex;
justify-content: center;
}
.booking-screen {
background-color: #fff;
height: 70px;
width: 100%;
margin: 15px 0;
transform: rotateX(-45deg);
box-shadow: 0 3px 10px rgba(255, 255, 255, 0.7);
}
p.text {
margin: 5px 0;
}
p.text span {
color: #6feaf6;
}
.screen-design{
margin-top:-1%
}
React
const {useState, useEffect} = React;
const row = 25;
const seating =[25,25]
const lastSeat =55;
function Example() {
const [count, setCount] = useState(0);
// Similar to componentDidMount and componentDidUpdate:
return (
<div className="container screen-design">
<br></br>
<div>
</div>
<div className="booking-movie-container">
<label>Pick a movie:</label>
<select>
<option value="10">Avengers: Endgame ($10)</option>
<option value="12">Joker ($12)</option>
<option value="8">Toy Story 4 ($8)</option>
<option value="9">The Lion King ($9)</option>
</select>
</div>
<ul className="booking-showcase">
<li>
<div className="booking-seat"></div>
<small>N/A</small>
</li>
<li>
<div className="booking-seat booking-selected"></div>
<small>booking-selected</small>
</li>
<li>
<div className="booking-seat booking-occupied"></div>
<small>booking-occupied</small>
</li>
</ul>
<div className="booking-container">
<div className="booking-screen"></div>
{Array.from({ length: row }, (rowelement, rowIndex) => <div className='booking-row'>
{Array.from({ length: seating.length }, (columnelement, columnIndex) => {
debugger;
return <div className='walking-space'>
<div className='booking-row'>
{Array.from({ length: seating[columnIndex] }, (columnelement, columnIndex) => {
return <div className="booking-seat"></div>
})}
</div>
</div>
})}
</div>)}
<div...