Skip to content

Commit

Permalink
feat: added index.tsx files for random controller
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullaalsulaiti committed Nov 30, 2023
1 parent 3b61de3 commit 55f8411
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { GlobalVolumeController } from './global-volume-controller'
import { title } from './styles'
import { Pomodoro } from './pomodoro'
import { ComboList } from './combo-list'
import { RandomModeButton } from './random-controller'

export const Header: React.FC = () => {
const theme = useThemeStore(set => set.theme)
Expand All @@ -20,6 +21,7 @@ export const Header: React.FC = () => {
<Pomodoro />
</div>
<div className="right-10 flex items-center gap-3">
<RandomModeButton />
<GlobalVolumeController />
<ThemeMenu />
<ComboList />
Expand Down
22 changes: 22 additions & 0 deletions src/components/header/random-controller/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { FiZap, FiZapOff } from 'react-icons/fi'

import { useThemeStore } from '@/stores/theme-store'
import { controllerButton } from './styles'
import { useGlobalRandomModeStore } from '@/stores/random-mode-store'

export function RandomModeButton() {
const { randomMode, setRandomMode } = useGlobalRandomModeStore()
const theme = useThemeStore(set => set.theme)

return (
<button
title="Enable/Disable Random Mode"
className={controllerButton({ theme })}
onClick={() => setRandomMode(!randomMode)}
data-umami-event="Enable/Disable Random Mode"
>
{randomMode ? <FiZapOff size={25} /> : <FiZap size={25} />}
</button>
)
}

0 comments on commit 55f8411

Please sign in to comment.