Skip to content

Commit 7cc41a3

Browse files
authored
Merge pull request #2813 from hackforla/widen-address-bar-2596
Widen address bar #2596
2 parents 403eb72 + 9ba0e5f commit 7cc41a3

5 files changed

Lines changed: 18 additions & 47 deletions

File tree

client/src/components/FoodSeeker/AddressDropDown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export default function AddressDropDown({ autoFocus }: AddressDropDownProps) {
298298
return options;
299299
}}
300300
sx={{
301-
width: 600,
301+
width: "100%",
302302
backgroundColor: "#F0F0F0",
303303
"& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline": {
304304
borderColor: "white",

client/src/components/FoodSeeker/SearchResults/ResultsFilters/ResultsFilters.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import AddressDropDown from "components/FoodSeeker/AddressDropDown";
55
import SwitchViewsButton from "./SwitchViewsButton";
66
import { TENANT_CONFIG } from "../../../../helpers/Constants";
77
import Geolocate from "./Geolocate";
8-
import useBreakpoints from "hooks/useBreakpoints";
98

109
interface ResultsFiltersProps {
1110
showList: boolean;
@@ -17,7 +16,6 @@ const ResultsFilters: FC<ResultsFiltersProps> = ({
1716
toggleShowList,
1817
}) => {
1918
const { taglineText } = TENANT_CONFIG;
20-
const { isMobile } = useBreakpoints();
2119

2220
return (
2321
<Grid2
@@ -31,7 +29,7 @@ const ResultsFilters: FC<ResultsFiltersProps> = ({
3129
>
3230
<Grid2
3331
display={{ xs: "none", sm: "block" }}
34-
sm={4}
32+
sm="auto"
3533
sx={{
3634
paddingLeft: "1rem",
3735
}}
@@ -52,45 +50,37 @@ const ResultsFilters: FC<ResultsFiltersProps> = ({
5250
<Grid2
5351
container
5452
xs={12}
55-
sm={8}
53+
sm={true}
5654
justifyContent="center"
5755
alignItems="center"
58-
wrap="wrap-reverse"
5956
>
6057
<Stack
61-
direction={{ xs: "column-reverse", sm: "row" }}
58+
direction={{ xs: "column-reverse", sm: "row", }}
6259
spacing={0.5}
6360
sx={{
6461
width: "100%",
6562
alignItems: "center",
6663
}}
6764
>
68-
<Grid2 xs={12} sm={6}>
6965
<Stack
7066
direction="row"
7167
alignItems="center"
7268
sx={{
73-
marginX: "1rem",
74-
maxWidth: "99vw",
7569
gap: "0.5rem",
70+
px: "1rem",
71+
boxSizing: "border-box",
72+
width: "100%",
7673
}}
7774
>
78-
<AddressDropDown autoFocus={false} />
79-
{isMobile && <Geolocate />}
80-
<Box
81-
sx={{
82-
maxWidth: "48px",
83-
boxSizing: "border-box",
84-
}}
85-
display={{ xs: "block", sm: "none" }}
86-
>
87-
<SwitchViewsButton
88-
isListView={showList}
89-
onClick={toggleShowList}
90-
/>
75+
<Box sx={{ flex: 1, minWidth: 0 }}>
76+
<AddressDropDown autoFocus={false} />
77+
</Box>
78+
79+
<Box display={{ xs: "flex", sm: "none" }} alignItems="center" gap="0.5rem">
80+
<Geolocate />
81+
<SwitchViewsButton isListView={showList} onClick={toggleShowList} />
9182
</Box>
9283
</Stack>
93-
</Grid2>
9484
</Stack>
9585
</Grid2>
9686
</Grid2>

client/src/components/FoodSeeker/SearchResults/ResultsMap/ResultsMap.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import RemoveIcon from "@mui/icons-material/RemoveRounded";
1515
import { MAPBOX_STYLE } from "constants/map";
1616
import { MAPBOX_ACCESS_TOKEN, DEFAULT_VIEWPORT } from "helpers/Constants";
1717
import useBreakpoints from "hooks/useBreakpoints";
18-
import useFeatureFlag from "hooks/useFeatureFlag";
1918
import "mapbox-gl/dist/mapbox-gl.css";
2019
import Map, { Layer, Marker, Source } from "react-map-gl";
2120
import { useLocation, useNavigate } from "react-router-dom";
@@ -110,7 +109,6 @@ const ResultsMap = ({
110109
const neighborhood = useNeighborhood() as { geojson?: any } | null;
111110
const regionGeoJSON = neighborhood?.geojson;
112111
const startIconCoordinates = searchCoordinates || userCoordinates;
113-
const hasAdvancedFilterFeatureFlag = useFeatureFlag("advancedFilter");
114112

115113
const onMouseEnter = useCallback(() => setCursor("pointer"), []);
116114
const onMouseLeave = useCallback(() => setCursor("auto"), []);
@@ -461,7 +459,8 @@ const ResultsMap = ({
461459
</Source>
462460
)}
463461
</Map>
464-
{!loading && hasAdvancedFilterFeatureFlag && (
462+
463+
{!loading && (
465464
<Grid
466465
container={isMobile}
467466
wrap={isMobile ? "nowrap" : undefined}

client/src/components/FoodSeeker/SearchResults/SearchResults.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,6 @@ const SearchResults = () => {
116116
}
117117
}, [positionDraggable]);
118118

119-
// USE EFFECT BASED ON THIS FUNCTION IN Mobile.js
120-
// const handleStop = (e, ui) => {
121-
// const windowHeight = window.innerHeight / 100;
122-
// let newY;
123-
// if (ui.y < 20 * windowHeight) {
124-
// newY = hasAdvancedFilterFeatureFlag ? (100 / window.innerHeight) * 60 : 0;
125-
// } else if (ui.y > 20 * windowHeight && ui.y < 40 * windowHeight) {
126-
// newY = 17;
127-
// } else if (ui.y > 40 * windowHeight) {
128-
// newY = 54;
129-
// }
130-
// setPosition({ x: 0, y: newY * windowHeight });
131-
// };
132-
133119
// If path starts with "widget", then set the state variable isWidget to true,
134120
// so we stay in widget mode (w/o normal App Header and Footer)
135121
useEffect(() => {

client/src/components/FoodSeeker/SearchResults/layouts/Mobile.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Draggable, { DraggableEvent, DraggableData } from "react-draggable";
44
import { useFilterPanel } from "appReducer";
55
import AttributionInfo from "../AttributionInfo";
66
import { useAppDispatch } from "../../../../appReducer";
7-
import useFeatureFlag from "hooks/useFeatureFlag";
87

98
const getOverlayStyle = (positionY: number) => ({
109
position: "absolute" as const,
@@ -29,7 +28,6 @@ interface MobileLayoutProps {
2928
const MobileLayout: FC<MobileLayoutProps> = ({ filters, map, list, showList }) => {
3029
const filterPanelOpen = useFilterPanel();
3130
const initialY = showList ? 5 : 57;
32-
const hasAdvancedFilterFeatureFlag = useFeatureFlag("advancedFilter");
3331
const dispatch = useAppDispatch();
3432
const [position, setPosition] = useState({
3533
x: 0,
@@ -49,17 +47,15 @@ const MobileLayout: FC<MobileLayoutProps> = ({ filters, map, list, showList }) =
4947
}
5048

5149
setPosition({ x: 0, y: newY * (window.innerHeight / 100) });
52-
}, [showList, filterPanelOpen, hasAdvancedFilterFeatureFlag]);
50+
}, [showList, filterPanelOpen]);
5351

5452
const handleDrag = (e: DraggableEvent, ui: DraggableData) => {
5553
setPosition({ x: 0, y: ui.y });
5654
};
5755

5856
const handleStop = (e: DraggableEvent, ui: DraggableData) => {
5957
const windowHeight = window.innerHeight / 100;
60-
const minY = hasAdvancedFilterFeatureFlag
61-
? (100 / window.innerHeight) * 60
62-
: 0;
58+
const minY = (100 / window.innerHeight) * 60;
6359
const maxY = 80;
6460
const snapPoints = [minY, 35, maxY];
6561
const snapThreshold = 5;

0 commit comments

Comments
 (0)