Skip to content

Commit 1bdc227

Browse files
committed
♻️ refactor: 불필요한 코드 변경
1 parent 0dd11e0 commit 1bdc227

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/components/FontSelect/FontSelect.jsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@ import { useState, useRef, useId } from 'react';
22
import useDetectClose from '../../hooks/useDetectClose';
33
import styles from './FontSelect.module.scss';
44

5-
const FONTS = ['Noto Sans', 'Pretendard', 'NanumMyeongjo', 'NanumSonPyeonjiCe'];
5+
const FONTS = ['Noto Sans', 'Pretendard', '나눔명조', '나눔손글씨 손편지체'];
66

77
const fontClassMap = {
8-
NotoSans: styles['font-noto'],
8+
'Noto Sans': styles['font-noto'],
99
Pretendard: styles['font-pretendard'],
10-
NanumMyeongjo: styles['font-nanum-myeongjo'],
11-
NanumSonPyeonjiCe: styles['font-naunm-hand'],
10+
나눔명조: styles['font-nanum-myeongjo'],
11+
'나눔손글씨 손편지체': styles['font-naunm-hand'],
1212
};
1313

14-
const formatFontName = (font) =>
15-
font
16-
.replace('NanumMyeongjo', '나눔명조')
17-
.replace('NanumSonPyeonjiCe', '나눔손글씨 손편지체');
18-
1914
export default function FontSelect({ defaultValue = 'Noto Sans', onChange }) {
2015
const dropdownRef = useRef(null);
2116
const id = useId();
@@ -40,7 +35,7 @@ export default function FontSelect({ defaultValue = 'Noto Sans', onChange }) {
4035
className={`${styles['dropdown__button']} ${fontClassMap[selected]}`}
4136
onClick={() => setIsOpen((prev) => !prev)}
4237
>
43-
{formatFontName(selected)}
38+
{selected}
4439
<span
4540
className={`${styles.dropdown__arrow} ${isOpen ? styles.open : ''}`}
4641
/>
@@ -53,7 +48,7 @@ export default function FontSelect({ defaultValue = 'Noto Sans', onChange }) {
5348
className={`${styles['dropdown__item']} ${fontClassMap[font]}`}
5449
onClick={() => handleSelect(font)}
5550
>
56-
{formatFontName(font)}
51+
{font}
5752
</li>
5853
))}
5954
</ul>

0 commit comments

Comments
 (0)