Skip to content

Commit

Permalink
Merge pull request #203 from bettersg/feature/169-map-header-button-u…
Browse files Browse the repository at this point in the history
…pdate

feature/169 update map header item styles
  • Loading branch information
neozhixuan authored Oct 31, 2023
2 parents 6891eec + 07b6dff commit 4e0fae5
Show file tree
Hide file tree
Showing 6 changed files with 398 additions and 168 deletions.
13 changes: 9 additions & 4 deletions client/components/home/UserInput/Location/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Text } from "@chakra-ui/react";
import { Box, Flex, Text } from "@chakra-ui/react";
import { fetchAddresses } from "api/onemap";
import { useUserInputs } from "hooks/useUserSelection";
import debounce from "lodash/debounce";
Expand All @@ -10,9 +10,10 @@ import { AddressOption } from "app-context/UserSelectionContext/types";
interface LocationProps {
handleBlur?: () => void;
showText: boolean;
containerStyle?: React.CSSProperties;
}

export const Location = ({ handleBlur, showText }: LocationProps) => {
export const Location = ({ handleBlur, showText, containerStyle = {} }: LocationProps) => {
const [showEmptyWarning, setShowEmptyWarning] = useState(false);
const { address, setAddress } = useUserInputs();
const { value: addressValue } = address;
Expand Down Expand Up @@ -46,7 +47,7 @@ export const Location = ({ handleBlur, showText }: LocationProps) => {
}, [addressValue]);

return (
<div style={{ flex: 1 }}>
<Box flex={1} minWidth={0}>
{showText && (
<Text fontWeight={500} fontSize="md" mb="8px">
Where are you at?
Expand All @@ -66,6 +67,10 @@ export const Location = ({ handleBlur, showText }: LocationProps) => {
setShowEmptyWarning(false);
}}
styles={{
container: (base) => ({
...base,
...containerStyle,
}),
control: (base) => ({
...base,
overflow: "hidden",
Expand All @@ -89,6 +94,6 @@ export const Location = ({ handleBlur, showText }: LocationProps) => {
handleShowError();
}}
/>
</div>
</Box>
);
};
22 changes: 17 additions & 5 deletions client/components/map/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
import { HamburgerIcon, Search2Icon, CloseIcon } from "@chakra-ui/icons";
import { Search2Icon, CloseIcon } from "@chakra-ui/icons";
import { MouseEventHandler } from "react";
import { IconButton } from "@chakra-ui/react";
import { Icon, IconButton } from "@chakra-ui/react";
import { COLORS } from "theme";

interface ButtonProps {
onClick: MouseEventHandler<HTMLButtonElement>;
height?: string;
}

// Button Design for the filter button
export const FilterButton = ({ onClick }: ButtonProps) => {
export const FilterButton = ({ onClick, height }: ButtonProps) => {
return (
<IconButton
variant="solid"
color={COLORS.gray[700]}
background={COLORS.gray[100]}
background="white"
aria-label="add line"
icon={<HamburgerIcon />}
icon={
<Icon viewBox="0 0 24 24">
<path
d="M12.5263 11.5H22M12.5263 6.3H22M12.5263 16.7H22M5.93056 5V11.5V18M5.93056 18L2 14.1M5.93056 18L9.86111 14.1"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</Icon>
}
onClick={onClick}
height={height}
/>
);
};
Expand Down
Loading

0 comments on commit 4e0fae5

Please sign in to comment.