diff --git a/src/components/Identify.jsx b/src/components/Identify.jsx index 1fee4ee..a4f8853 100644 --- a/src/components/Identify.jsx +++ b/src/components/Identify.jsx @@ -6,7 +6,7 @@ import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Col, Container } from 'reactstrap'; -import { toQueryString } from '@ugrc/utilities'; +import { toQueryString } from '@ugrc/utilities/src'; import ky from 'ky'; import './Identify.css'; @@ -181,7 +181,7 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { }, ], ], - [] + [], ); const reverseGeocode = useCallback( @@ -208,7 +208,7 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { console.warn(ex); } }, - [wkid, apiKey] + [wkid, apiKey], ); const get = useCallback( @@ -243,14 +243,14 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { } catch (error) { console.warn(error); } - }) + }), ); await reverseGeocode(mapPoint); controller.current = null; }, - [apiKey, wkid, reverseGeocode] + [apiKey, wkid, reverseGeocode], ); useEffect(() => { diff --git a/src/components/MapView.jsx b/src/components/MapView.jsx index 11feb11..79b30b8 100644 --- a/src/components/MapView.jsx +++ b/src/components/MapView.jsx @@ -53,7 +53,7 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { mapView.current.on('click', onClick); }); - setSelectorOptions({ + const selectorOptions = { view: mapView.current, quadWord: import.meta.env.VITE_DISCOVER, baseLayers: ['Hybrid', 'Lite', 'Terrain', 'Topo', 'Color IR'], @@ -67,7 +67,16 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { }, ], position: 'top-right', - }); + }; + + // select a random index from baseLayers and convert the string to an object + const randomBaseMapIndex = Math.floor(Math.random() * selectorOptions.baseLayers.length); + selectorOptions.baseLayers[randomBaseMapIndex] = { + token: selectorOptions.baseLayers[randomBaseMapIndex], + selected: true, + }; + + setSelectorOptions(selectorOptions); return () => { mapView.current.destroy(); @@ -76,7 +85,7 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { }, [setMapView, onClick]); return ( -
+
{selectorOptions ? : null}
); diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index 18020a6..0463d7e 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -1,13 +1,19 @@ +import { Bars3Icon } from '@heroicons/react/24/solid'; import PropTypes from 'prop-types'; -// import './Sidebar.css'; +import { useState } from 'react'; +import { Button, Dialog, DialogTrigger, Modal, ModalOverlay } from 'react-aria-components'; -export default function Sidebar({ children }) { +export function Sidebar({ children }) { return ( -
-
-
- {children} -
+
+ +
+ {children}
); @@ -16,3 +22,62 @@ export default function Sidebar({ children }) { Sidebar.propTypes = { children: PropTypes.node.isRequired, }; + +export const SideDrawer = ({ children }) => { + let [isOpen, setOpen] = useState(true); + + return ( + + + + + + {({ close }) => ( + <> + {children} + + + )} + + + + + ); +}; + +SideDrawer.propTypes = { + children: PropTypes.node.isRequired, +}; + +export const DoubleSidebar = ({ children }) => { + return ( +
+ {children} +
+ ); +}; + +export const Drawer = () => { + return ( +
+ +

+
+ ); +}; + +export const DefaultDrawerTrigger = () => ( +
+ +

+
+);