Skip to content

Commit

Permalink
Merge pull request #319 from phlask/V.2-SearchBar-(Desktop)-#302
Browse files Browse the repository at this point in the history
Task 302: Create V.2 SearchBar (Desktop)
  • Loading branch information
Erw1nn authored Jun 21, 2023
2 parents 7046c31 + 1f9ce41 commit d37255e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
25 changes: 16 additions & 9 deletions src/components/ReactGoogleMaps/ReactGoogleMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Map, GoogleApiWrapper, Marker } from 'google-maps-react';
import React, { Component } from 'react';
import ReactTouchEvents from 'react-touch-events';
import SearchBar from '../SearchBar/SearchBar';
import TutorialModal from '../TutorialModal/TutorialModal';
import styles from './ReactGoogleMaps.module.scss';
import { connect } from 'react-redux';
import SelectedTap from '../SelectedTap/SelectedTap';
Expand All @@ -23,6 +24,7 @@ import MapMarkersFood from '../MapMarkers/MapMarkersFood';
import { isMobile } from 'react-device-detect';
import Toolbar from '../Toolbar/Toolbar';
import MapMarkersMapper from '../MapMarkers/MapMarkersMapper';
import Stack from '@mui/material/Stack';

// // Actual Magic: https://stackoverflow.com/a/41337005
// // Distance calculates the distance between two lat/lon pairs
Expand Down Expand Up @@ -248,9 +250,9 @@ export class ReactGoogleMaps extends Component {
onDragEnd = (_, map) => {
this.setState({
currlat: map.center.lat(),
currlon: map.center.lng(),
currlon: map.center.lng()
});
}
};

toggleTapInfo = isExpanded => {
this.setState({
Expand Down Expand Up @@ -341,13 +343,18 @@ export class ReactGoogleMaps extends Component {
</Map>
</div>
</ReactTouchEvents>
<div className={styles.searchBarContainer}>
<SearchBar
className="searchBar"
search={location => this.searchForLocation(location)}
/>
</div>
<Toolbar />
<Stack position="absolute" bottom="0px" height="143px" width="34%">
<Stack direction="row" spacing={2}>
<SearchBar
className="searchBar"
search={location => this.searchForLocation(location)}
/>
<TutorialModal
showButton={isMobile ? !this.state.isSearchBarShown : true}
/>
</Stack>
<Toolbar />
</Stack>
<SelectedTap></SelectedTap>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/ReactGoogleMaps/ReactGoogleMaps.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.searchBarContainer {
position: relative;
top: 57px;
position: absolute;
width: 34%;
bottom: 75px;
}

.mapContainer {
Expand Down
17 changes: 10 additions & 7 deletions src/components/SearchBar/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
faSearchLocation,
faChevronLeft
} from '@fortawesome/free-solid-svg-icons';
import TutorialModal from '../TutorialModal/TutorialModal';
import Input from '@mui/material/Input';
import InputAdornment from '@mui/material/InputAdornment';
import SearchIcon from '@mui/icons-material/Search';

class SearchBar extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -86,13 +88,18 @@ class SearchBar extends React.Component {
}`}
>
{/* type="search" is only HTML5 compliant */}
<input
<Input
{...getInputProps({
placeholder: 'Search For Taps Near...'
placeholder: 'Search For Resources Near...'
})}
className={`${styles.searchInput} form-control`}
type="search"
ref={this.state.refSearchBar}
startAdornment={
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
}
/>
{loading && (
<div className={styles.autocompleteDropdown}>
Expand Down Expand Up @@ -150,10 +157,6 @@ class SearchBar extends React.Component {
/>
</button>
)}

<TutorialModal
showButton={isMobile ? !this.state.isSearchBarShown : true}
/>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchBar/SearchBar.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.desktopSearch {
display: flex;
flex-direction: row;
width: 100%;
width: 84%;
justify-content: flex-start;
padding: 1rem 0 0 1rem;
pointer-events: none;
Expand Down
6 changes: 3 additions & 3 deletions src/components/TutorialModal/TutorialModal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
.infoButton {
max-width: 30px;
max-height: 30px;
position: absolute;
top: 1rem;
right: 1rem;
position: relative;
top: 1.5rem;
right: 0.5rem;
border-radius: 50%;
background-color: white;

Expand Down

0 comments on commit d37255e

Please sign in to comment.