Skip to content

Commit

Permalink
Merge pull request #1770 from hackforla/1765-styling-searchCriteria
Browse files Browse the repository at this point in the history
1765 Update Styling System for SearchCriteria.js
  • Loading branch information
andyarensman authored Aug 22, 2023
2 parents cb0345c + b574a04 commit 71e8f9c
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions client/src/components/Admin/SearchCriteria.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
import makeStyles from "@mui/styles/makeStyles";
import {
Card,
CardContent,
Expand All @@ -14,6 +13,8 @@ import {
RadioGroup,
Radio,
TextField,
Box,
Divider,
} from "@mui/material";
import RadioTrueFalseEither from "./ui/RadioTrueFalseEither";
import LocationAutocomplete from "./LocationAutocomplete";
Expand All @@ -28,15 +29,6 @@ import Label from "./ui/Label";
// this problem.
// import { Input } from "../UI";

const useStyles = makeStyles(() => ({
card: {
margin: "0px",
},
formLabel: {
margin: "1rem 0 .5rem",
},
}));

const closeTo = (lat1, lon1, lat2, lon2) => {
return Math.abs(lat1 - lat2) + Math.abs(lon1 - lon2) < 0.01;
};
Expand Down Expand Up @@ -103,8 +95,6 @@ const SearchCriteria = ({
console.log(criteria);
};

const classes = useStyles();

const handleRadioChange = (evt) => {
const val = evt.target.value;
setUseMyLocation(val);
Expand Down Expand Up @@ -139,7 +129,7 @@ const SearchCriteria = ({
};

return (
<Card className={classes.card}>
<Card>
<CardContent>
<Grid container spacing={4}>
<Grid item xs={12} sm={6}>
Expand Down Expand Up @@ -184,14 +174,15 @@ const SearchCriteria = ({
variant="outlined"
placeholder="Category(ies)"
fullWidth
labelId="select-multiple-chip"
value={criteria.categoryIds}
onChange={(event) => {
const categoryIds = event.target.value;
setCriteria({ ...criteria, categoryIds });
}}
inputProps={{ id: "select-categories" }}
renderValue={(ids) => (
<div>
<Typography>
{ids &&
ids.length > 0 &&
categories &&
Expand All @@ -205,11 +196,13 @@ const SearchCriteria = ({
)
.join(", ")
: "(Any)"}
</div>
</Typography>
)}
>
<MenuItem disabled value="">
<em>(All Categories)</em>
<Typography sx={{ fontStyle: "italic" }}>
(All Categories)
</Typography>
</MenuItem>
{categories.map((category) => (
<MenuItem key={category.id} value={category.id}>
Expand Down Expand Up @@ -370,7 +363,9 @@ const SearchCriteria = ({
<Grid container>
<Label id="radius" label="Location" />
<Grid item container alignItems="center">
<div style={{ marginRight: "0.5rem" }}>{"Within "}</div>
<Typography sx={{ marginRight: "0.5rem" }}>
{"Within "}
</Typography>
<Select
name="radius"
variant="outlined"
Expand Down Expand Up @@ -404,7 +399,9 @@ const SearchCriteria = ({
50
</MenuItem>
</Select>
<div style={{ margin: "0 1rem 0 .5rem" }}>{"miles of"}</div>
<Typography sx={{ margin: "0 1rem 0 .5rem" }}>
{"miles of"}
</Typography>
</Grid>
<Grid item xs={12}>
{/* If we got location from browser, allow using current location */}
Expand All @@ -419,21 +416,21 @@ const SearchCriteria = ({
control={<Radio color="primary" />}
style={{ alignItems: "flex-start" }}
label={
<div>
<Box>
<Typography>My Location: </Typography>
<Typography>{`(${userLatitude.toFixed(
6
)}, ${userLongitude.toFixed(6)})`}</Typography>
</div>
</Box>
}
/>
<FormControlLabel
value="custom"
control={<Radio color="primary" />}
style={{ alignItems: "flex-start" }}
label={
<div>
<hr />
<Box>
<Divider />
<Typography>{`Custom Location:`} </Typography>
{customPlaceName ? (
<Typography>{customPlaceName}</Typography>
Expand All @@ -448,12 +445,12 @@ const SearchCriteria = ({
fullWidth
setLocation={setLocation}
/>
</div>
</Box>
}
/>
</RadioGroup>
) : (
<div>
<Box>
{customPlaceName ? (
<Typography>{customPlaceName}</Typography>
) : null}
Expand All @@ -468,7 +465,7 @@ const SearchCriteria = ({
fullWidth
setLocation={setLocation}
/>
</div>
</Box>
)}
</Grid>
</Grid>
Expand Down

0 comments on commit 71e8f9c

Please sign in to comment.