Skip to content

Commit

Permalink
fix: implement requested PR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benlister-okta committed Jan 30, 2024
1 parent f52021e commit 6383c3b
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions packages/odyssey-react-mui/src/labs/DataFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
useRef,
useState,
} from "react";
import styled from "@emotion/styled";
import { Autocomplete } from "../Autocomplete";
import { Box } from "../Box";
import { TagList } from "../TagList";
Expand Down Expand Up @@ -203,11 +204,10 @@ const DataFilters = ({
// Iterating to find the label
return value
.map((valueElement) => {
if (typeof valueElement !== "string") {
return valueElement.label;
if (typeof valueElement === "string") {
return undefined;
}

return;
return valueElement.label;
})
.filter((item): item is string => Boolean(item));
}
Expand Down Expand Up @@ -269,6 +269,15 @@ const DataFilters = ({
setFilters(updatedFilters);
}, [inputValues, filtersProp]);

const AutocompleteOuterContainer = styled.div`
display: flex;
gap: 2;
align-items: center;
alignitems: "flex-end";
`;
const AutocompleteInnerContainer = styled.div`
width: "100%";
`;
const filterMenu = useMemo(
() => (
<>
Expand Down Expand Up @@ -391,14 +400,8 @@ const DataFilters = ({
{/* Autocomplete */}
{filterPopoverCurrentFilter?.variant === "autocomplete" &&
filterPopoverCurrentFilter?.options && (
<Box
sx={{
display: "flex",
gap: 2,
alignItems: "flex-end",
}}
>
<Box sx={{ width: "100%" }}>
<AutocompleteOuterContainer>
<AutocompleteInnerContainer>
<Autocomplete
label={filterPopoverCurrentFilter.label}
value={
Expand Down Expand Up @@ -431,13 +434,13 @@ const DataFilters = ({
})
)}
/>
</Box>
</AutocompleteInnerContainer>
<Button
variant="primary"
endIcon={<CheckIcon />}
type="submit"
/>
</Box>
</AutocompleteOuterContainer>
)}
{/* Text or Number */}
{(filterPopoverCurrentFilter?.variant === "text" ||
Expand Down

0 comments on commit 6383c3b

Please sign in to comment.