Skip to content

Commit

Permalink
feat: changed icons for forward, backward
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Nov 27, 2024
1 parent de9d4f4 commit 21f81d5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
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;
}
`

0 comments on commit 21f81d5

Please sign in to comment.