From ea4879f7612e2020ab30678149aa530b074346d0 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Fri, 8 Jul 2022 21:57:42 +0700 Subject: [PATCH] fix(#2572): fix audio player and some layout --- src/components/AudioPlayer/hooks.tsx | 7 ++++--- .../components/ElementContainer/index.tsx | 12 +++++++++-- .../AddCardForm/components/Form/index.tsx | 5 ++++- src/features/AddCardForm/styled.tsx | 13 +++++++++++- .../components/CardsList/index.tsx | 4 ++-- src/features/BuyMatchPopup/styled.tsx | 2 +- src/features/Combobox/index.tsx | 2 +- src/features/ProfileCard/styled.tsx | 21 ++++++++++++++++++- .../components/FormHighlights/hooks.tsx | 4 ++++ .../components/FormHighlights/index.tsx | 3 ++- .../components/FormHighlights/styled.tsx | 12 +++++++++++ .../components/MatchesHighlights/styled.tsx | 6 ++++++ .../components/PriceInfo/styled.tsx | 3 +-- .../components/ThanksPopup/styled.tsx | 3 ++- 14 files changed, 81 insertions(+), 16 deletions(-) diff --git a/src/components/AudioPlayer/hooks.tsx b/src/components/AudioPlayer/hooks.tsx index 99589e7e..660ccd9c 100644 --- a/src/components/AudioPlayer/hooks.tsx +++ b/src/components/AudioPlayer/hooks.tsx @@ -6,7 +6,7 @@ import { import { readToken } from 'helpers' export const useAudioPlayer = (asset: string) => { - const [audio, setAudio] = useState() + const [audio, setAudio] = useState(null) const [playing, setPlaying] = useState(false) const toggle = (e: SyntheticEvent) => { @@ -16,15 +16,16 @@ export const useAudioPlayer = (asset: string) => { } useEffect(() => { + setPlaying(false) + audio?.pause() asset && setAudio(new Audio(`${asset}?access_token=${readToken()}`)) // eslint-disable-next-line react-hooks/exhaustive-deps }, [asset]) useEffect(() => { - if (!audio) return playing ? audio?.play() : audio?.pause() // eslint-disable-next-line react-hooks/exhaustive-deps - }, [playing, audio]) + }, [playing]) useEffect(() => { audio?.addEventListener('ended', () => setPlaying(false)) diff --git a/src/features/AddCardForm/components/ElementContainer/index.tsx b/src/features/AddCardForm/components/ElementContainer/index.tsx index ed093cd9..27c3a955 100644 --- a/src/features/AddCardForm/components/ElementContainer/index.tsx +++ b/src/features/AddCardForm/components/ElementContainer/index.tsx @@ -32,13 +32,19 @@ const Label = styled.label` ${isMobileDevice ? css` - height: 36px; + height: 27px; font-size: 12px; padding: 0 13px; align-items: center; + + :nth-child(3){ width: 48%; } + + /* & .test_class { + width: 48%; + } */ :nth-child(4){ width: 48%; } @@ -74,6 +80,7 @@ const ElementWrapper = styled.div` type Props = { backgroundColor?: string, children: ReactNode, + className?: string, label?: string, width?: string, } @@ -81,10 +88,11 @@ type Props = { export const ElementContainer = ({ backgroundColor, children, + className, label, width, }: Props) => ( -