forked from hkam0006/RentConnect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tenant property search in dashboard
- Loading branch information
Showing
5 changed files
with
245 additions
and
8 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
38 changes: 38 additions & 0 deletions
38
frontend/src/renter-components/renter_home/ChipContainer.jsx
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,38 @@ | ||
import { Paper, Chip } from "@mui/material"; | ||
|
||
const ChipContainer = ({chips, setChips, onDeleteChip}) => { | ||
|
||
const handleDelete = (chipToDelete) => () => { | ||
setChips((chips) => chips.filter((chip) => chip !== chipToDelete)); | ||
}; | ||
|
||
if (chips.length === 0) return <></> | ||
|
||
return ( | ||
<Paper | ||
sx={{ | ||
display: 'flex', | ||
justifyContent: 'start', | ||
padding: 1, | ||
mt: 2, | ||
boxShadow: 0, | ||
borderRadius: 5, | ||
gap: 1, | ||
flexWrap: "wrap" | ||
}} | ||
> | ||
{chips.map((data) => { | ||
return ( | ||
<Chip | ||
key={data} | ||
label={data} | ||
size='small' | ||
onDelete={handleDelete(data)} | ||
/> | ||
) | ||
})} | ||
</Paper> | ||
) | ||
} | ||
|
||
export default ChipContainer |
42 changes: 42 additions & 0 deletions
42
frontend/src/renter-components/renter_home/PropertyCard.jsx
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,42 @@ | ||
const PropertyCard = ({loading, property, showModal}) => { | ||
const navigate = useNavigate(); | ||
return <> | ||
{!loading ? <Card sx={{ borderRadius: 0, boxShadow: 2 }}> | ||
<CardMedia | ||
component="img" | ||
height="200" | ||
image={property.property_pictures[0]} | ||
// alt={property.title} | ||
/> | ||
<CardContent> | ||
<Typography variant="subtitle" component="div"> | ||
{fullAddress(property)} | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary"> | ||
{property.property_type} | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary"> | ||
${property.property_rent} {property.property_rent_frequency} | ||
</Typography> | ||
<Button | ||
variant="contained" | ||
color="primary" | ||
fullWidth | ||
sx={{ mt: 2 }} | ||
onClick={showModal} | ||
> | ||
View Details | ||
</Button> | ||
</CardContent> | ||
</Card> : <Box sx={{height: "100%"}}> | ||
<Skeleton animation="wave" height={200} variant='rectangular' width={"100%"}/> | ||
<Skeleton animation="wave" height={50} width={"100%"}/> | ||
<Skeleton animation="wave" height={20} width={"50%"}/> | ||
<Skeleton animation="wave" height={20} width={"20%"}/> | ||
<Skeleton animation="wave" height={70} width={"100%"}/> | ||
</Box> | ||
} | ||
</> | ||
} | ||
|
||
export default PropertyCard |
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
44 changes: 44 additions & 0 deletions
44
frontend/src/renter-components/renter_home/SearchPropertyFilter.jsx
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,44 @@ | ||
import { Box, Modal, Grid, Container, Card, CardMedia, CardContent, Typography, Button, Skeleton, Paper, InputBase,Divider, IconButton, Chip, Menu, MenuItem, AppBar, Toolbar, Stack, Dialog, DialogTitle, DialogContent} from '@mui/material'; | ||
import HouseIcon from '@mui/icons-material/House'; | ||
import FilterAltIcon from '@mui/icons-material/FilterAlt'; | ||
import SearchIcon from '@mui/icons-material/Search'; | ||
|
||
const SearchPropertyFilter = ({onSearch, value, onChange, handleSubmit}) => { | ||
return( | ||
<Paper | ||
component="form" | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
onSearch(); | ||
}} | ||
sx={{ p: '2px 4px', display: 'flex', alignItems: 'center', width: "100%", margin: "auto", borderRadius: 3, minWidth: "300px", mt: 2 }} | ||
> | ||
<Box sx={{ p: '10px', display: "flex", alignItems: "center" }}> | ||
<HouseIcon color='primary' aria-label="menu"/> | ||
</Box> | ||
<InputBase | ||
sx={{ ml: 1, flex: 1 }} | ||
value={value} | ||
autoFocus | ||
placeholder="Search region, suburb or postcode" | ||
inputProps={{ 'aria-label': 'search suburb' }} | ||
onChange={(e) => onChange(e.target.value)} | ||
onKeyDown={(ev) => { | ||
if (ev.key === 'Enter' ){ | ||
ev.preventDefault() | ||
handleSubmit(ev) | ||
} | ||
}} | ||
/> | ||
<IconButton sx={{ p: '10px' }} aria-label="search" onClick={(e) => handleSubmit(e)}> | ||
<SearchIcon /> | ||
</IconButton> | ||
<Divider sx={{ height: 28, m: 0.5 }} orientation="vertical" /> | ||
<IconButton color="primary" sx={{ p: '10px' }} aria-label="directions" > | ||
<FilterAltIcon /> | ||
</IconButton> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default SearchPropertyFilter |