Skip to content

Commit

Permalink
feat: 이모지 한글자로 세기 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Arooming committed Jan 17, 2024
1 parent d5c0ab7 commit 32bcab2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/LecueNote/components/WriteNote/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import GraphemeSplitter from 'grapheme-splitter';
import { useEffect, useState } from 'react';

import { WriteNoteProps } from '../../type/lecueNoteType';
Expand All @@ -13,6 +14,8 @@ function WriteNote({
}: WriteNoteProps) {
const nickname = '와라라라랄라';

// 이모지 글자 수 세기 관련 라이브러리
const split = new GraphemeSplitter();
const today = new Date();
const [dateArr, setDateArr] = useState([0, 0, 0]);

Expand All @@ -33,7 +36,7 @@ function WriteNote({
<S.Date>
{dateArr[0]}.{dateArr[1]}.{dateArr[2]}
</S.Date>
<S.Counter>({contents.length}/1000)</S.Counter>
<S.Counter>({split.splitGraphemes(contents).length}/1000)</S.Counter>
</S.BottomContentsWrapper>
</S.LecueNote>
<S.Notice>*욕설/비속어는 자동 필터링됩니다.</S.Notice>
Expand Down

0 comments on commit 32bcab2

Please sign in to comment.