-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #414
- Loading branch information
Showing
17 changed files
with
186 additions
and
31 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
File renamed without changes.
File renamed without changes.
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,15 @@ | ||
import { Location } from '../../types/sparkeats'; | ||
|
||
export function LocationHeader({ location }: { location: Location }) { | ||
return ( | ||
<div className="review-header"> | ||
<div className="review-header__title"> | ||
<h2 className="review-header__name">{location.name}</h2> | ||
<p className="review-header__city"> | ||
{location.city}, {location.region} | ||
</p> | ||
</div> | ||
<div className="review-header__backdrop"></div> | ||
</div> | ||
); | ||
} |
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,41 @@ | ||
import { Location } from '../../types/sparkeats'; | ||
|
||
function LocationAddress({ location }: { location: Location }) { | ||
return ( | ||
<> | ||
<address className="review-overview__address"> | ||
<p>{location?.address}</p> | ||
</address> | ||
{location?.phone && ( | ||
<p> | ||
<a className="review-overview__phone" href={`tel:${location?.phone}`}> | ||
{location?.phone} | ||
</a> | ||
</p> | ||
)} | ||
{location?.url && ( | ||
<p> | ||
<a className="location-card__url" href={`${location?.url}`}> | ||
Visit Site | ||
</a> | ||
</p> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export function LocationOverview({ location }: { location: Location }) { | ||
return ( | ||
<section className="review-overview"> | ||
<header> | ||
<h1 className="review-overview__title"> | ||
{location?.reviews.length !== 1 | ||
? `${location.reviewCount} Reviews` | ||
: `${location.reviewCount} Review`} | ||
</h1> | ||
<div className="review-overview__stars">Average Stars</div> | ||
</header> | ||
<LocationAddress location={location} /> | ||
</section> | ||
); | ||
} |
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,48 @@ | ||
import { Link } from 'react-router-dom'; | ||
import { Location, Review } from '../../types/sparkeats'; | ||
|
||
export function LocationReviews({ | ||
location, | ||
reviews = [], | ||
}: { | ||
location: Location; | ||
reviews: Review[]; | ||
}) { | ||
return ( | ||
<div className="review-container"> | ||
<Link | ||
className="button__full-width" | ||
to={'/reviews/new'} | ||
state={{ location }} | ||
> | ||
Add a review | ||
</Link> | ||
|
||
{reviews.map((review: Review) => ( | ||
<article key={review.id} className="review-submission"> | ||
<h3 className="review-submission__reviewer">{review.reviewerName}</h3> | ||
<div className="review-submission__date"> | ||
{/* Created year/month/day*/} | ||
</div> | ||
<div | ||
className="location-card__star-rating" | ||
aria-label={`${review.starRating}`} | ||
> | ||
Stars | ||
</div> | ||
<h4 className="review-submission__title">Comments</h4> | ||
<p className="review-submission__review">{review.text}</p> | ||
{review.imageURL && ( | ||
<div className="review-submission__image-container"> | ||
<img | ||
className="review-submission__image" | ||
src={review.imageURL} | ||
alt={review.imageDescription} | ||
/> | ||
</div> | ||
)} | ||
</article> | ||
))} | ||
</div> | ||
); | ||
} |
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,26 @@ | ||
import { useLocation as useWindowLocation } from 'react-router-dom'; | ||
import { Link } from 'react-router-dom'; | ||
import { LocationHeader } from './LocationHeader'; | ||
import { LocationOverview } from './LocationOverview'; | ||
import { LocationReviews } from './LocationReviews'; | ||
|
||
export function LocationPage() { | ||
const { | ||
state: { location }, | ||
} = useWindowLocation(); | ||
|
||
return ( | ||
<main className="review-page"> | ||
<div className="review-nav"> | ||
<Link className="review-nav__link" to={'/'}> | ||
<span className="review-nav__svg"></span> | ||
Back to home | ||
</Link> | ||
</div> | ||
<LocationHeader location={location} /> | ||
<LocationReviews location={location} reviews={location.reviews} /> | ||
{/* TODO rename to LocationDetails */} | ||
<LocationOverview location={location} /> | ||
</main> | ||
); | ||
} |
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
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,6 +1,6 @@ | ||
body { | ||
font-family: $roboto-condensed-stack; | ||
color: $primary-color; | ||
background: url('./img/background-img.png'); | ||
background: url('/img/background-img.png'); | ||
background-blend-mode: darken; | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,6 @@ declare global { | |
interface Window { | ||
__SPARKEATS_VERSION__: string; | ||
} | ||
|
||
type WindowLocation = Location; | ||
} |
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