Skip to content

Commit

Permalink
♻️ step to timer status 네이밍 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sumi-0011 committed Dec 1, 2023
1 parent efa00da commit 17661b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/timer/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client';
import TimerView from '@/app/timer/TimerView';
import useStep from '@/app/timer/useStep';
import useTimer from '@/app/timer/useTimer';
import useTimerStatus from '@/app/timer/useTimerStatus';
import Header from '@/components/Layout/Header';
import { css } from '@styled-system/css';

export default function TimerPage() {
const { step, stepLabel, onNextStep } = useStep();
const { step, stepLabel, onNextStep } = useTimerStatus();
const { formattedTime } = useTimer(step);

const onFinish = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/timer/useTimer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { type StepType } from '@/app/timer/useStep';
import { type StepType } from '@/app/timer/useTimerStatus';

export default function useTimer(status: StepType, initSeconds = 600) {
const [second, setSecond] = useState(initSeconds); // 남은 시간 (단위: 초)
Expand Down
8 changes: 4 additions & 4 deletions src/app/timer/useStep.ts → src/app/timer/useTimerStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react';

export type StepType = 'ready' | 'progress' | 'stop';

const STEP_LABEL = {
const TIMER_STATUS = {
ready: {
title: '준비 되셨나요?',
desc: '타이머를 눌러서 10분의 미션을 완성해 주세요!',
Expand All @@ -17,10 +17,10 @@ const STEP_LABEL = {
},
} as const;

function useStep() {
function useTimerStatus() {
const [step, setStep] = useState<StepType>('ready');

const stepLabel = STEP_LABEL[step];
const stepLabel = TIMER_STATUS[step];

const onNextStep = (nextStep: StepType) => {
setStep(nextStep);
Expand All @@ -29,4 +29,4 @@ function useStep() {
return { step, onNextStep, stepLabel };
}

export default useStep;
export default useTimerStatus;

0 comments on commit 17661b0

Please sign in to comment.