Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akrakman committed Oct 26, 2022
1 parent 072ac44 commit f116ba9
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/frontend/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@
"postId": 1
}
]
}
}
3 changes: 1 addition & 2 deletions src/frontend/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
],
"icons": [],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
Expand Down
54 changes: 27 additions & 27 deletions src/frontend/src/components/List.tsx
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;
13 changes: 4 additions & 9 deletions src/frontend/src/components/SearchAndDisplayResults.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { ToggleButton, ToggleButtonGroup } from '@mui/material';
import React, {
useState,
useRef,
useCallback,
KeyboardEvent,
} from 'react';
import React, { useState, useRef, useCallback, KeyboardEvent } from 'react';
import SingleCard from './SingleCard';
import useSearchApartment from './getsApartments';
import SearchBar from './SearchBar';
Expand Down Expand Up @@ -78,7 +73,7 @@ export default function Searching() {
}*/

//useEffect(() => {
// triggers a post request whenever a button is selected
// triggers a post request whenever a button is selected
// handlePost(query, selected);
//}, [selected]);

Expand Down Expand Up @@ -115,8 +110,8 @@ export default function Searching() {
onChange={handleChange}
/>
</div>*/}
</div>
<SearchBar/>
</div>
<SearchBar />
<br />
<ToggleButtonGroup
color="primary"
Expand Down
50 changes: 26 additions & 24 deletions src/frontend/src/components/SearchBar.tsx
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;
54 changes: 27 additions & 27 deletions src/frontend/src/components/SearchBarStyles.css
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;
}
54 changes: 28 additions & 26 deletions src/frontend/src/staticdata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[{
[
{
"id": 1,
"name": "Champaign park",
"address": "West Green",
Expand All @@ -7,8 +8,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 2,
"name": "Maywoods Apartments",
"address": "West springfield",
Expand All @@ -17,8 +18,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 3,
"name": "Town and County",
"address": "Healey street",
Expand All @@ -27,8 +28,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 4,
"name": "Lancaster Apartments",
"address": "Wright street",
Expand All @@ -37,8 +38,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 5,
"name": "cool park",
"address": "White St.",
Expand All @@ -47,8 +48,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 6,
"name": "Champaign park",
"address": "1032 E Kerr Ave",
Expand All @@ -57,8 +58,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 7,
"name": "not a park",
"address": "Wright street",
Expand All @@ -67,8 +68,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 8,
"name": "park park",
"address": "West springfield",
Expand All @@ -77,8 +78,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 9,
"name": "Urbana park",
"address": "51 E John",
Expand All @@ -87,8 +88,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 10,
"name": "Good park",
"address": "Wright street",
Expand All @@ -97,8 +98,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 11,
"name": "Bad park",
"address": "West springfield",
Expand All @@ -107,8 +108,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 12,
"name": "Spooky park",
"address": "Green st.",
Expand All @@ -117,8 +118,8 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
},
{
},
{
"id": 13,
"name": "Corporate park",
"address": "202 E Daniel St.",
Expand All @@ -127,4 +128,5 @@
"rating": 0,
"price_min": "500",
"price_max": "1000"
}]
}
]

3 comments on commit f116ba9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCover
TOTAL1710100%

Tests Skipped Failures Errors Time
36 0 💤 0 ❌ 0 🔥 0.647s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCover
TOTAL1710100%

Tests Skipped Failures Errors Time
36 0 💤 0 ❌ 0 🔥 0.760s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCover
TOTAL1710100%

Tests Skipped Failures Errors Time
36 0 💤 0 ❌ 0 🔥 0.833s ⏱️

Please sign in to comment.