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) => ( -