Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changed icons for forward, backward #2478

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions public/ForwardIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/RewindIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 45 additions & 4 deletions src/components/mindset/components/PlayerContols/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { IconButton } from '@mui/material'
import { useCallback } from 'react'
import styled from 'styled-components'
import ChevronLeftIcon from '~/components/Icons/ChevronLeftIcon'
import ChevronRightIcon from '~/components/Icons/ChevronRightIcon.js'
import PauseIcon from '~/components/Icons/PauseIcon'
import PlayIcon from '~/components/Icons/PlayIcon'
import { Flex } from '~/components/common/Flex'
Expand Down Expand Up @@ -31,10 +29,28 @@ export const PlayerControl = ({ markers }: Props) => {
[playerRef],
)

const handleRewind = () => {
if (playerRef) {
const newTime = playerRef.getCurrentTime() - 15

playerRef.seekTo(newTime, 'seconds')
}
}

const handleFastForward = () => {
if (playerRef) {
const newTime = playerRef.getCurrentTime() + 15

playerRef.seekTo(newTime, 'seconds')
}
}

return showPlayer ? (
<Wrapper>
<Controls>
<ChevronLeftIcon />
<RewindIconWrapper onClick={handleRewind}>
<img alt="" src="public/RewindIcon.svg" />
</RewindIconWrapper>
<Action
data-testid="play-pause-button"
onClick={(e) => {
Expand All @@ -45,7 +61,9 @@ export const PlayerControl = ({ markers }: Props) => {
>
{isPlaying ? <PauseIcon data-testid="pause-icon" /> : <PlayIcon data-testid="play-icon" />}
</Action>
<ChevronRightIcon />
<ForwardIconWrapper onClick={handleFastForward}>
<img alt="" src="public/ForwardIcon.svg" />
</ForwardIconWrapper>
</Controls>
{true && (
<ProgressBar
Expand Down Expand Up @@ -96,3 +114,26 @@ const Action = styled(IconButton)`
overflow: hidden;
}
`

const RewindIconWrapper = styled.div`
display: flex;
align-items: center;
justify-content: center;
margin: 1px 0 0 1px;
cursor: pointer;
img {
width: 20px;
height: auto;
}
`

const ForwardIconWrapper = styled.div`
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
img {
width: 24px;
height: auto;
}
`
Loading