From ea67dfdfd5e379bed6b90dfff91d3e2cb872a06b Mon Sep 17 00:00:00 2001 From: Micheal Huang <65090844+astoppop@users.noreply.github.com> Date: Tue, 11 Jul 2023 19:51:59 -0400 Subject: [PATCH] Fixed mobile selected tap close and added mobile selected tap transition animations (#326) * Fixed mobile selected tap close * Added opening and closing animation for selected tap mobile --- src/components/SelectedTap/SelectedTap.js | 298 +++++++++--------- .../SelectedTapMobile/SelectedTapMobile.js | 21 +- 2 files changed, 158 insertions(+), 161 deletions(-) diff --git a/src/components/SelectedTap/SelectedTap.js b/src/components/SelectedTap/SelectedTap.js index f669b9cf..eb038ce4 100644 --- a/src/components/SelectedTap/SelectedTap.js +++ b/src/components/SelectedTap/SelectedTap.js @@ -1,30 +1,26 @@ /* eslint-disable no-console */ +import { + faCaretLeft +} from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; +import { isMobile } from 'react-device-detect'; import ReactGA from 'react-ga4'; import { connect } from 'react-redux'; import { + PHLASK_TYPE_WATER, toggleInfoExpanded, toggleInfoWindow, - toggleInfoWindowClass, - PHLASK_TYPE_WATER + toggleInfoWindowClass } from '../../actions/actions'; -import { isMobile } from 'react-device-detect'; -// import { connect } from 'react-redux' -import './SelectedTap.css'; -import styles from './SelectedTap.module.scss'; +import SelectedTapHours from '../SelectedTapHours/SelectedTapHours'; +import SelectedTapIcons from '../SelectedTapIcons/SelectedTapIcons'; import sampleImg from '../images/phlask-tessellation.png'; import sampleImg2x from '../images/phlask-tessellation@2x.png'; -import phlaskGreen from '../images/phlaskGreen.png'; import phlaskBlue from '../images/phlaskBlue.png'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { - faCaretLeft, - faCaretDown, - faCaretUp, - faTimes -} from '@fortawesome/free-solid-svg-icons'; -import SelectedTapIcons from '../SelectedTapIcons/SelectedTapIcons'; -import SelectedTapHours from '../SelectedTapHours/SelectedTapHours'; +import phlaskGreen from '../images/phlaskGreen.png'; +import './SelectedTap.css'; +import styles from './SelectedTap.module.scss'; import { SwipeableDrawer } from '@mui/material'; @@ -55,7 +51,8 @@ class SelectedTap extends React.Component { accessibility: phlaskGreen }, walkingDuration: 0, - walkingDistance: 0 + walkingDistance: 0, + infoCollapseMobile: false }; getWalkingDurationAndTimes = () => { @@ -126,6 +123,10 @@ class SelectedTap extends React.Component { } } } + + setInfoCollapseMobile = (collapse) => { + this.setState({infoCollapseMobile: collapse}); + } toggleInfoWindow(shouldShow) { this.props.toggleInfoWindowClass(shouldShow); @@ -135,9 +136,8 @@ class SelectedTap extends React.Component { } // Animate Out else { - setTimeout(() => { - this.props.toggleInfoWindow(false); - }, this.state.animationSpeed); + this.props.toggleInfoWindow(false); + this.setInfoCollapseMobile(false); } } @@ -169,7 +169,7 @@ class SelectedTap extends React.Component { label: `${this.props.selectedPlace?.organization}, ${this.props.selectedPlace?.address}` }); } - + // Handle Times setCurrentDate() { @@ -209,154 +209,152 @@ class SelectedTap extends React.Component { } render() { - if (this.props.showingInfoWindow) { - return ( -