@@ -2,20 +2,15 @@ import { useState, useRef, useId } from 'react';
22import useDetectClose from '../../hooks/useDetectClose' ;
33import styles from './FontSelect.module.scss' ;
44
5- const FONTS = [ 'Noto Sans' , 'Pretendard' , 'NanumMyeongjo ' , 'NanumSonPyeonjiCe ' ] ;
5+ const FONTS = [ 'Noto Sans' , 'Pretendard' , '나눔명조 ' , '나눔손글씨 손편지체 ' ] ;
66
77const 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-
1914export 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