-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from HFG43/add-experience-details-page
Add Experience Details Page
- Loading branch information
Showing
13 changed files
with
379 additions
and
43 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { useSelector } from 'react-redux'; | ||
import { useState } from 'react'; | ||
import { Link, useParams } from 'react-router-dom'; | ||
import { BiChevronRightCircle, BiChevronLeftCircle, BiGift } from 'react-icons/bi'; | ||
import ExperienceIncluded from './ExperienceIncluded'; | ||
import getRandomDiscount from '../logic/utils'; | ||
|
||
function ExperienceDetails() { | ||
const { experienceID } = useParams(); | ||
|
||
const [discount] = useState(getRandomDiscount({ start: 5, end: 50 })); | ||
|
||
const { experiences } = useSelector((state) => state.experiences); | ||
|
||
const selectedExperience = experiences.find((exp) => exp.id === parseInt(experienceID, 10)); | ||
|
||
const experienceSlug = selectedExperience?.name.replace(/\s/g, '-').toLowerCase(); | ||
|
||
const experienceReservationURL = `/${experienceSlug}/${experienceID}/new-reservation`; | ||
|
||
const detailsIncluded = selectedExperience?.details === undefined ? '' : selectedExperience?.details; | ||
|
||
return ( | ||
<div className="w-100"> | ||
<div className="experience-details w-100"> | ||
<div className="experience-image w-100"> | ||
<img src={selectedExperience?.image} alt={selectedExperience?.name} className="fluid-img" /> | ||
<ExperienceIncluded mediaStyles="desktop" detailsIncluded={detailsIncluded} /> | ||
</div> | ||
<div className="experience-content w-100"> | ||
<h2 className="experience-name text-right">{selectedExperience?.name}</h2> | ||
<p className="experience-desc text-right"> | ||
{selectedExperience?.description} | ||
</p> | ||
<ul className="experience-prices w-100"> | ||
<li> | ||
<span>Experience Fee</span> | ||
<span> | ||
$ | ||
{selectedExperience?.experience_fee} | ||
</span> | ||
</li> | ||
<li> | ||
<span>Add testing fee</span> | ||
<span> | ||
$ | ||
{selectedExperience?.add_testing_fee} | ||
</span> | ||
</li> | ||
<li> | ||
<span>Reserve Full Table</span> | ||
<span> | ||
$ | ||
{selectedExperience?.reserve_full_table} | ||
</span> | ||
</li> | ||
<li> | ||
<span>Guests</span> | ||
<span> | ||
{selectedExperience?.guests} | ||
{' '} | ||
people | ||
</span> | ||
</li> | ||
</ul> | ||
<ExperienceIncluded mediaStyles="mobile" detailsIncluded={detailsIncluded} /> | ||
{ | ||
discount && ( | ||
<div className="experience-offers"> | ||
<span className="bold"> | ||
{discount} | ||
% OFF! | ||
</span> | ||
{' '} | ||
<span>as a gift of the day!</span> | ||
{' '} | ||
<BiGift /> | ||
</div> | ||
) | ||
} | ||
<div className="reserve-button"> | ||
<Link to={experienceReservationURL} className="btn-reserve btn-default d-flex"> | ||
<span>Reserve Now</span> | ||
<BiChevronRightCircle /> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className="footer-content"> | ||
<Link to="/MainPage" className="btn-default btn-back"> | ||
<BiChevronLeftCircle /> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default ExperienceDetails; |
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,23 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
function ExperienceIncluded({ detailsIncluded, mediaStyles }) { | ||
return ( | ||
<div className={`experience-extra-details w-100 ${mediaStyles}`}> | ||
<h3 className="experience-extra-details-title"> | ||
¿What does this experience include? | ||
</h3> | ||
<p className="experience-included w-100"> | ||
{ !detailsIncluded | ||
? (<span className="no-details"><i>No details included</i></span>) | ||
: (detailsIncluded)} | ||
</p> | ||
</div> | ||
); | ||
} | ||
|
||
ExperienceIncluded.propTypes = { | ||
detailsIncluded: PropTypes.string.isRequired, | ||
mediaStyles: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default ExperienceIncluded; |
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
Oops, something went wrong.