Skip to content

Commit a4961b3

Browse files
committed
feat: 온도에 맞는 텍스트 보여주는 함수 추가
1 parent 5699640 commit a4961b3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const TEMPERATURE_RANGE = [
2+
{ min: 0, max: 10, description: '따뜻함이 필요한 따숨님' },
3+
{ min: 10, max: 25, description: '살짝 포근한 따숨님' },
4+
{ min: 25, max: 40, description: '따스한 온기를 가진 따숨님' },
5+
{ min: 40, max: 55, description: '마음이 따뜻한 따숨님' },
6+
{ min: 55, max: 70, description: '훈훈한 따숨님' },
7+
{ min: 70, max: 80, description: '정말 따뜻한 따숨님' },
8+
{ min: 85, max: 100, description: '사랑이 넘치는 따숨님' },
9+
];

src/pages/MyPage/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,27 @@ import { useState } from 'react';
33
import { AlarmIcon, ArrowLeftIcon, PersonIcon } from '@/assets/icons';
44
import ConfirmModal from '@/components/ConfirmModal';
55

6+
import { TEMPERATURE_RANGE } from './constants';
7+
68
const DUMMY_TEMP = 48.5;
79
const DUMMY_ZIP_CODE = '235EA';
810

911
const MyPage = () => {
1012
const [isOpenModal, setIsOpenModal] = useState(false);
1113

14+
const getDescriptionByTemperature = (temp: number) => {
15+
const range = TEMPERATURE_RANGE.find((range) => temp >= range.min && temp < range.max);
16+
return range?.description;
17+
};
18+
19+
const description = getDescriptionByTemperature(DUMMY_TEMP);
20+
1221
return (
1322
<>
1423
{isOpenModal && (
1524
<ConfirmModal
1625
title="정말 탈퇴하시겠어요?"
17-
description="탈퇴하시면, 지금까지 나눈 따듯한 마음들이 사라져요"
26+
description="탈퇴하시면, 지금까지 나눈 따뜻한 마음들이 사라져요"
1827
cancelText="되돌아가기"
1928
confirmText="탈퇴하기"
2029
onCancel={() => setIsOpenModal(false)}
@@ -41,7 +50,7 @@ const MyPage = () => {
4150
</section>
4251
<section>
4352
<div className="mb-2 flex justify-between">
44-
<p className="body-sb text-gray-60">따듯한 따숨님</p>
53+
<p className="body-sb text-gray-60">{description}</p>
4554
<p className="body-sb text-accent-1">{DUMMY_TEMP}</p>
4655
</div>
4756
<div className="h-4 w-full rounded-full bg-white">

0 commit comments

Comments
 (0)