-
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.
- Loading branch information
Showing
7 changed files
with
114 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,4 +138,4 @@ | |
"postId": 1 | ||
} | ||
] | ||
} | ||
} |
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,34 +1,34 @@ | ||
import React from "react"; | ||
import data from "../staticdata.json"; | ||
import "./SearchBarStyles.css"; | ||
import SingleCard from "./SingleCard"; | ||
import React from 'react'; | ||
import data from '../staticdata.json'; | ||
import './SearchBarStyles.css'; | ||
import SingleCard from './SingleCard'; | ||
|
||
interface Props { | ||
props: string; | ||
props: string; | ||
} | ||
|
||
const List = ({ props }: Props) => { | ||
// eslint-disable-next-line | ||
const filteredData = data.filter((el: any) => { | ||
if (props === '') { | ||
return el; | ||
} else if (el.name) { | ||
return el.name.toLowerCase().includes(props); | ||
} | ||
}) | ||
return ( | ||
<div className="list"> | ||
{filteredData.splice(0, 5).map((apartment, index) => { | ||
if (props !== '') { | ||
return ( | ||
<div key={index} className="box"> | ||
<p key={apartment.id}>{apartment.name}</p> | ||
</div> | ||
); | ||
} | ||
})} | ||
</div> | ||
); | ||
} | ||
// eslint-disable-next-line | ||
const filteredData = data.filter((el: any) => { | ||
if (props === '') { | ||
return el; | ||
} else if (el.name) { | ||
return el.name.toLowerCase().includes(props); | ||
} | ||
}); | ||
return ( | ||
<div className="list"> | ||
{filteredData.splice(0, 5).map((apartment, index) => { | ||
if (props !== '') { | ||
return ( | ||
<div key={index} className="box"> | ||
<p key={apartment.id}>{apartment.name}</p> | ||
</div> | ||
); | ||
} | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default List; |
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,29 +1,31 @@ | ||
import React from "react"; | ||
import { useState } from "react"; | ||
import TextField from "@mui/material/TextField"; | ||
import List from "./List"; | ||
import "./SearchBarStyles.css"; | ||
import React from 'react'; | ||
import { useState } from 'react'; | ||
import TextField from '@mui/material/TextField'; | ||
import List from './List'; | ||
import './SearchBarStyles.css'; | ||
|
||
const SearchBar = () => { | ||
const [inputText, setInputText] = useState(""); | ||
return ( | ||
<div className="main"> | ||
<h1>Apartment Search</h1> | ||
<div className="search"> | ||
<TextField | ||
id="outlined-basic" | ||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setInputText(e.target.value.toLowerCase())} | ||
variant="outlined" | ||
fullWidth | ||
label="Search" | ||
className="myInput" | ||
/> | ||
const [inputText, setInputText] = useState(''); | ||
return ( | ||
<div className="main"> | ||
<h1>Apartment Search</h1> | ||
<div className="search"> | ||
<TextField | ||
id="outlined-basic" | ||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => | ||
setInputText(e.target.value.toLowerCase()) | ||
} | ||
variant="outlined" | ||
fullWidth | ||
label="Search" | ||
className="myInput" | ||
/> | ||
</div> | ||
<div className="myDropdown"> | ||
<List props={inputText} /> | ||
</div> | ||
</div> | ||
<div className="myDropdown"> | ||
<List props={inputText} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,37 +1,37 @@ | ||
.search { | ||
background-position: 14px 12px; | ||
background-repeat: no-repeat; | ||
font-size: 16px; | ||
padding: 14px 20px 12px 45px; | ||
border: none; | ||
margin-left: 600px; | ||
width: 500px; | ||
background-position: 14px 12px; | ||
background-repeat: no-repeat; | ||
font-size: 16px; | ||
padding: 14px 20px 12px 45px; | ||
border: none; | ||
margin-left: 600px; | ||
width: 500px; | ||
} | ||
|
||
.box { | ||
text-align: center; | ||
border: black ridge 1px; | ||
border-radius: 10px; | ||
margin: 3px; | ||
width: 20rem; | ||
padding-left: 10px; | ||
text-align: center; | ||
border: black ridge 1px; | ||
border-radius: 10px; | ||
margin: 3px; | ||
width: 20rem; | ||
padding-left: 10px; | ||
} | ||
|
||
.list { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-sizing: border-box; | ||
} | ||
|
||
.myDropdown { | ||
min-width: 230px; | ||
overflow: auto; | ||
z-index: 1; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-sizing: border-box; | ||
min-width: 230px; | ||
overflow: auto; | ||
z-index: 1; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-sizing: border-box; | ||
} |
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
f116ba9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report
f116ba9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report
f116ba9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report