-
Notifications
You must be signed in to change notification settings - Fork 3
Landlord
Kinjal Jasani edited this page Oct 8, 2021
·
2 revisions
src/components/Landlord
holds all components associated with a landlord for use on the landlord's page. The data used to populate the landlord information is retrieved from the Firebase database.
Landlord
|
--- Header
- Takes a
landlord
, the number of reviews, a function to handle a click on a photo, and the average rating as props. - Renders a header displaying landlord information on the landlord's page. The header is only the top part of the landlord's page, with the rest of the page consisting of reviews for the landlord. The function to handle a click is activated if a user clicks on the landlord's photo on the page, if the photo for the landlord is not the default photo (meaning that there is at least 1 image that is part of the landlord data retrieved from the Firebase database).
type Props = {
readonly landlord: Landlord;
readonly numReviews: number;
readonly handleClick: () => void;
readonly averageRating: number;
};
export type Landlord = {
readonly name: string;
readonly contact: string | null;
readonly avgRating: number;
readonly profilePhoto?: string;
readonly photos: readonly string[]; // can be empty
readonly reviews: readonly string[]; // array of Review IDs in reviews collection
readonly properties: readonly string[]; // array of Apartment IDs in apartments collection
readonly address: string | null;
};