Skip to content

Commit

Permalink
feat(utils): create padZero function
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Nov 27, 2023
1 parent 4a35ec7 commit 35ab6ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/header/pomodoro/config-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Dialog, Transition } from '@headlessui/react'
import { Fragment, useState } from 'react'

import { padZero } from './pad-zero'
import { display, minuteConfigInput } from './styles'
import { useThemeStore } from '~/stores/theme-store'
import { padZero } from '~/utils/pad-zero'

interface Props {
displayMinutes: string
Expand Down
5 changes: 3 additions & 2 deletions src/components/header/pomodoro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { FiPause, FiPlay, FiRotateCw } from 'react-icons/fi'

import { PomodoroStatus, usePomodoroStore } from '~/stores/pomodoro-store'
import { useThemeStore } from '~/stores/theme-store'

import { padZero } from '~/utils/pad-zero'

import { ConfigModal } from './config-modal'
import { container, controlButton } from './styles'

const padZero = (value: number) => value.toString().padStart(2, '0')

export function Pomodoro() {
const setPomodoroStatus = usePomodoroStore(state => state.setPomodoroStatus)
const theme = useThemeStore(state => state.theme)
Expand Down
1 change: 1 addition & 0 deletions src/utils/pad-zero.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const padZero = (value: number) => value.toString().padStart(2, '0')

0 comments on commit 35ab6ed

Please sign in to comment.