From 60d24050ee34becb58db3f3e0e8fbdcc719ec623 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 23 Oct 2020 20:22:12 +1100 Subject: [PATCH] Added back show more option for maps but made it on by default --- src/components/map/MapSettings.js | 214 +++++++++++++++++------------- src/modals/EditMapModal.js | 4 + 2 files changed, 128 insertions(+), 90 deletions(-) diff --git a/src/components/map/MapSettings.js b/src/components/map/MapSettings.js index 62eb49b..3c6181b 100644 --- a/src/components/map/MapSettings.js +++ b/src/components/map/MapSettings.js @@ -1,5 +1,7 @@ import React from "react"; -import { Flex, Box, Label, Input, Checkbox } from "theme-ui"; +import { Flex, Box, Label, Input, Checkbox, IconButton } from "theme-ui"; + +import ExpandMoreIcon from "../../icons/ExpandMoreIcon"; import { isEmpty } from "../../helpers/shared"; @@ -19,6 +21,8 @@ function MapSettings({ mapState, onSettingsChange, onStateSettingsChange, + showMore, + onShowMoreChange, }) { function handleFlagChange(event, flag) { if (event.target.checked) { @@ -127,97 +131,127 @@ function MapSettings({ my={1} /> - - - - s.value === map.quality) - } - isDisabled={mapEmpty} - onChange={(option) => onSettingsChange("quality", option.value)} - isOptionDisabled={(option) => - mapEmpty || - (option.value !== "original" && !map.resolutions[option.value]) - } - isSearchable={false} - /> + {showMore && ( + <> + + + + s.value === map.quality) + } + isDisabled={mapEmpty} + onChange={(option) => + onSettingsChange("quality", option.value) + } + isOptionDisabled={(option) => + mapEmpty || + (option.value !== "original" && + !map.resolutions[option.value]) + } + isSearchable={false} + /> + + + + )} + + + + + + + + - - + )} - - - - - - - - - + { + e.stopPropagation(); + e.preventDefault(); + onShowMoreChange(!showMore); + }} + sx={{ + transform: `rotate(${showMore ? "180deg" : "0"})`, + alignSelf: "center", + }} + aria-label={showMore ? "Show Less" : "Show More"} + title={showMore ? "Show Less" : "Show More"} + > + + ); } diff --git a/src/modals/EditMapModal.js b/src/modals/EditMapModal.js index 7db5671..da46b01 100644 --- a/src/modals/EditMapModal.js +++ b/src/modals/EditMapModal.js @@ -96,6 +96,8 @@ function EditMapModal({ isOpen, onDone, map, mapState }) { ...mapStateSettingChanges, }; + const [showMoreSettings, setShowMoreSettings] = useState(true); + return (