diff --git a/src/components/Popup.css b/src/components/Popup.css index 1e057c6..21e210b 100644 --- a/src/components/Popup.css +++ b/src/components/Popup.css @@ -70,4 +70,35 @@ cursor: pointer; } +.collapse-button { + position: absolute; + right: 20px; + margin: -20px 0 0; + border: 0; + font: 24px sans-serif; + font-weight: normal; + color: #c3c3c3; + text-decoration: none; + font-weight: bold; + background: transparent; + cursor: pointer; + transition: all .5s ease-in-out; +} +.collapse-button.up { + transform: rotate(-90deg); +} + +.popup-names { + max-height: 0; + transition: all 1s ease-in-out; + overflow: hidden; +} + +.popup-names.show { + max-height: 400px; +} + +.popup-names.hide { + max-height: 1px; +} diff --git a/src/components/Popup.jsx b/src/components/Popup.jsx index 79d5985..09e774b 100644 --- a/src/components/Popup.jsx +++ b/src/components/Popup.jsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { countryCodeToFlag } from '../helpers/countryUtil'; import { formatDate } from '../helpers/timeUtil'; import Elevation from './Elevation'; @@ -5,6 +6,7 @@ import './Popup.css'; const Popup = ({geojson, handleClickPopup}) => { + const [collapsed, setCollapsed] = useState(false); const handleClick = () => { handleClickPopup("close") @@ -12,23 +14,31 @@ const Popup = ({geojson, handleClickPopup}) => { if (!geojson.title) return return ( - <> -