Skip to content

Commit 71e19cd

Browse files
Merge pull request #1079 from CodeForAfrica/fix/mobile-fixes
Enhance Mobile Navigation UX and Styling
2 parents a55a70d + 53e9ad2 commit 71e19cd

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Link } from "@commons-ui/next";
21
import {
32
IconButton,
43
InputBase,
@@ -37,9 +36,26 @@ function DropdownSearch({
3736
setSelectedLocation(null);
3837
};
3938

39+
const handleClickSearch = () => {
40+
if (onClick) {
41+
onClick(selectedLocation);
42+
} else if (selectedLocation) {
43+
const href = `${hrefProp}/${selectedLocation}`;
44+
router.push(href);
45+
} else if (query) {
46+
router.push("/404");
47+
}
48+
};
49+
4050
const handleSelect = (code, name) => {
4151
setQuery(name.toLowerCase());
4252
setSelectedLocation(code);
53+
if (onClick) {
54+
onClick(code);
55+
} else {
56+
const href = `${hrefProp}/${code}`;
57+
router.push(href);
58+
}
4359
};
4460

4561
useEffect(() => {
@@ -53,17 +69,6 @@ function DropdownSearch({
5369
}
5470
}, [locations, selectedLocation, query]);
5571

56-
const handleClickSearch = () => {
57-
if (onClick) {
58-
onClick(selectedLocation);
59-
} else if (selectedLocation) {
60-
const href = `${hrefProp}/${selectedLocation}`;
61-
router.push(href);
62-
} else if (query) {
63-
router.push("/404");
64-
}
65-
};
66-
6772
let iconComponent = SearchIcon;
6873
let iconBorder;
6974
if (variant === "explore") {
@@ -171,14 +176,13 @@ function DropdownSearch({
171176
>
172177
{suggestions.map(({ name, code }) => (
173178
<ListItem
174-
component={Link}
175-
href={`${hrefProp}/${code}`}
176179
variant="subtitle1"
177180
underline="none"
178181
onClick={() => handleSelect(code, name)}
179182
sx={({ typography, palette }) => ({
180183
paddingLeft: typography.pxToRem(20),
181184
color: palette.text.hint,
185+
cursor: "pointer",
182186
})}
183187
key={code}
184188
>

apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ function MobileNavigation({
105105
padding: 0,
106106
}}
107107
>
108-
<Section>
108+
<Section
109+
fixed={false}
110+
sx={{
111+
padding: `0 ${theme.typography.pxToRem(20)}`,
112+
}}
113+
>
109114
<Grid
110115
container
111116
alignItems="center"
@@ -152,15 +157,20 @@ function MobileNavigation({
152157
padding: `${typography.pxToRem(40)} 0`,
153158
})}
154159
>
155-
<Section>
160+
<Section
161+
fixed={false}
162+
sx={{
163+
padding: `0 ${theme.typography.pxToRem(20)}`,
164+
}}
165+
>
156166
<Menu
157167
explorePagePath={explorePagePath}
158168
links={menus}
159169
socialLinks={socialLinks}
160170
LinkProps={{
161171
sx: {
162-
padding: 0,
163172
margin: `${theme.typography.pxToRem(10)} 0`,
173+
color: "text.secondary",
164174
},
165175
}}
166176
>

0 commit comments

Comments
 (0)